Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
Scrutinizer Auto-Fixer
2018-05-12 11:10:23 +00:00
parent 08d9d51bea
commit b633d82c5e
17 changed files with 77 additions and 71 deletions

View File

@@ -86,7 +86,7 @@ class AssignedUsersMapper extends DeckMapper implements IPermissionMapper {
$userManager = $this->userManager;
$assignment->resolveRelation('participant', function() use (&$userManager, &$assignment) {
$user = $userManager->get($assignment->getParticipant());
if($user !== null) {
if ($user !== null) {
return new User($user);
}
return null;

View File

@@ -140,7 +140,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
public function findToDelete() {
// add buffer of 5 min
$timeLimit = time()-(60*5);
$timeLimit = time() - (60 * 5);
$sql = 'SELECT id, title, owner, color, archived, deleted_at FROM `*PREFIX*deck_boards` ' .
'WHERE `deleted_at` > 0 AND `deleted_at` < ?';
return $this->findEntities($sql, [$timeLimit]);
@@ -181,17 +181,17 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
$userManager = $this->userManager;
$groupManager = $this->groupManager;
$acl->resolveRelation('participant', function($participant) use (&$acl, &$userManager, &$groupManager) {
if($acl->getType() === Acl::PERMISSION_TYPE_USER) {
if ($acl->getType() === Acl::PERMISSION_TYPE_USER) {
$user = $userManager->get($participant);
if($user !== null) {
if ($user !== null) {
return new User($user);
}
\OC::$server->getLogger()->debug('User ' . $acl->getId() . ' not found when mapping acl ' . $acl->getParticipant());
return null;
}
if($acl->getType() === Acl::PERMISSION_TYPE_GROUP) {
if ($acl->getType() === Acl::PERMISSION_TYPE_GROUP) {
$group = $groupManager->get($participant);
if($group !== null) {
if ($group !== null) {
return new Group($group);
}
\OC::$server->getLogger()->debug('Group ' . $acl->getId() . ' not found when mapping acl ' . $acl->getParticipant());
@@ -208,7 +208,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
$userManager = $this->userManager;
$board->resolveRelation('owner', function($owner) use (&$userManager) {
$user = $userManager->get($owner);
if($user !== null) {
if ($user !== null) {
return new User($user);
}
return null;

View File

@@ -67,7 +67,7 @@ class Card extends RelationalEntity {
}
public function getDuedate($isoFormat = false) {
if($this->duedate === null) {
if ($this->duedate === null) {
return null;
}
$dt = new DateTime($this->duedate);
@@ -83,16 +83,16 @@ class Card extends RelationalEntity {
$due = strtotime($this->duedate);
$today = new DateTime();
$today->setTime( 0, 0);
$today->setTime(0, 0);
$match_date = new DateTime($this->duedate);
$match_date->setTime( 0, 0);
$match_date->setTime(0, 0);
$diff = $today->diff( $match_date );
$diffDays = (integer)$diff->format('%R%a'); // Extract days count in interval
$diff = $today->diff($match_date);
$diffDays = (integer) $diff->format('%R%a'); // Extract days count in interval
if($due !== false) {
if ($due !== false) {
if ($diffDays === 1) {
$json['overdue'] = self::DUEDATE_NEXT;
}

View File

@@ -178,7 +178,7 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
$userManager = $this->userManager;
$card->resolveRelation('owner', function($owner) use (&$userManager) {
$user = $userManager->get($owner);
if($user !== null) {
if ($user !== null) {
return new User($user);
}
return null;

View File

@@ -32,7 +32,7 @@ class RelationalEntity extends Entity implements \JsonSerializable {
/**
* Mark a property as relation so it will not get updated using Mapper::update
* @param $property string Name of the property
* @param string $property string Name of the property
*/
public function addRelation($property) {
if (!in_array($property, $this->_relations, true)) {
@@ -42,7 +42,7 @@ class RelationalEntity extends Entity implements \JsonSerializable {
/**
* Mark a property as resolvable via resolveRelation()
* @param $property string Name of the property
* @param string $property string Name of the property
*/
public function addResolvable($property) {
$this->_resolvedProperties[$property] = null;
@@ -77,7 +77,7 @@ class RelationalEntity extends Entity implements \JsonSerializable {
}
}
foreach ($this->_resolvedProperties as $property => $value) {
if($value !== null) {
if ($value !== null) {
$json[$property] = $value;
}
}
@@ -107,29 +107,29 @@ class RelationalEntity extends Entity implements \JsonSerializable {
*/
public function resolveRelation($property, $resolver) {
$result = null;
if($property !== null && $this->$property !== null) {
if ($property !== null && $this->$property !== null) {
$result = $resolver($this->$property);
}
if($result instanceof RelationalObject || $result === null) {
if ($result instanceof RelationalObject || $result === null) {
$this->_resolvedProperties[$property] = $result;
} else {
throw new \Exception('resolver must return an instance of RelationalObject');
}
}
public function __call($methodName, $args){
$attr = lcfirst( substr($methodName, 7) );
if(array_key_exists($attr, $this->_resolvedProperties) && strpos($methodName, 'resolve') === 0) {
if($this->_resolvedProperties[$attr] !== null) {
public function __call($methodName, $args) {
$attr = lcfirst(substr($methodName, 7));
if (array_key_exists($attr, $this->_resolvedProperties) && strpos($methodName, 'resolve') === 0) {
if ($this->_resolvedProperties[$attr] !== null) {
return $this->_resolvedProperties[$attr];
}
return $this->getter($attr);
}
$attr = lcfirst( substr($methodName, 3) );
if(array_key_exists($attr, $this->_resolvedProperties) && strpos($methodName, 'set') === 0) {
if(!is_scalar($args[0])) {
$attr = lcfirst(substr($methodName, 3));
if (array_key_exists($attr, $this->_resolvedProperties) && strpos($methodName, 'set') === 0) {
if (!is_scalar($args[0])) {
$args[0] = $args[0]['primaryKey'];
}
parent::setter($attr, $args);

View File

@@ -52,7 +52,7 @@ class RelationalObject implements \JsonSerializable {
* @throws \Exception
*/
public function getObjectSerialization() {
if($this->object instanceof \JsonSerializable) {
if ($this->object instanceof \JsonSerializable) {
$this->object->jsonSerialize();
} else {
throw new \Exception('jsonSerialize is not implemented on ' . get_class($this));