Rewrites:

- converted single-line if() block to multi-line and with curly braces
- "imported" SPL classes to have unified code style
- always initialize your variables ... :-/
- added some empty lines/spaces for better readability

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2019-02-19 01:56:41 +01:00
parent 3b646644c0
commit 9fa812b35d
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
8 changed files with 33 additions and 15 deletions

View file

@ -7,6 +7,7 @@
namespace Friendica\Model;
use Friendica\Database\DBA;
use \BadMethodCallException;
class ItemDeliveryData
{
@ -71,7 +72,7 @@ class ItemDeliveryData
public static function insert($item_id, array $fields)
{
if (empty($item_id)) {
throw new \BadMethodCallException('Empty item_id');
throw new BadMethodCallException('Empty item_id');
}
$fields['iid'] = $item_id;
@ -92,7 +93,7 @@ class ItemDeliveryData
public static function update($item_id, array $fields)
{
if (empty($item_id)) {
throw new \BadMethodCallException('Empty item_id');
throw new BadMethodCallException('Empty item_id');
}
if (empty($fields)) {
@ -113,7 +114,7 @@ class ItemDeliveryData
public static function delete($item_id)
{
if (empty($item_id)) {
throw new \BadMethodCallException('Empty item_id');
throw new BadMethodCallException('Empty item_id');
}
return DBA::delete('item-delivery-data', ['iid' => $item_id]);

View file

@ -173,6 +173,8 @@ class Photo extends BaseObject
*/
public static function getImageForPhoto(array $photo)
{
$data = "";
if ($photo["backend-class"] == "") {
// legacy data storage in "data" column
$i = self::selectFirst(["data"], ["id" => $photo["id"]]);
@ -189,6 +191,7 @@ class Photo extends BaseObject
if ($data === "") {
return null;
}
return new Image($data, $photo["type"]);
}
@ -219,11 +222,13 @@ class Photo extends BaseObject
{
$fields = self::getFields();
$values = array_fill(0, count($fields), "");
$photo = array_combine($fields, $values);
$photo["backend-class"] = Storage\SystemResource::class;
$photo["backend-ref"] = $filename;
$photo["type"] = $mimetype;
$photo["cacheable"] = false;
return $photo;
}

View file

@ -50,8 +50,14 @@ class Database implements IStorage
{
return DBA::delete('storage', ['id' => $ref]);
}
public static function getOptions() { return []; }
public static function saveOptions($data) { return []; }
public static function getOptions()
{
return [];
}
public static function saveOptions($data)
{
return [];
}
}

View file

@ -6,6 +6,8 @@
namespace Friendica\Model\Storage;
use \BadMethodCallException;
/**
* @brief System resource storage class
*
@ -32,12 +34,12 @@ class SystemResource implements IStorage
public static function put($data, $filename = "")
{
throw new \BadMethodCallException();
throw new BadMethodCallException();
}
public static function delete($filename)
{
throw new \BadMethodCallException();
throw new BadMethodCallException();
}
public static function getOptions()