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
2017-01-31 09:28:59 +00:00
parent 5c1713d928
commit 094aa6d636
19 changed files with 40 additions and 40 deletions

View File

@@ -40,7 +40,7 @@ class Application extends App {
$container = $this->getContainer();
$server = $container->getServer();
$container->registerService('SharingMiddleware', function ($container) use ($server) {
$container->registerService('SharingMiddleware', function($container) use ($server) {
return new SharingMiddleware(
$container,
$server->getRequest(),
@@ -55,7 +55,7 @@ class Application extends App {
public function registerNavigationEntry() {
$container = $this->getContainer();
$container->query('OCP\INavigationManager')->add(function () use ($container) {
$container->query('OCP\INavigationManager')->add(function() use ($container) {
$urlGenerator = $container->query('OCP\IURLGenerator');
$l10n = $container->query('OCP\IL10N');
return [

View File

@@ -28,7 +28,7 @@ class CardArchivedException extends \Exception {
* Constructor
* @param string $msg the error message
*/
public function __construct($msg=""){
public function __construct($msg = "") {
parent::__construct($msg);
}
}

View File

@@ -32,7 +32,7 @@ class CardController extends Controller {
private $userId;
private $cardService;
public function __construct($appName, IRequest $request, CardService $cardService, $userId){
public function __construct($appName, IRequest $request, CardService $cardService, $userId) {
parent::__construct($appName, $request);
$this->userId = $userId;
$this->cardService = $cardService;
@@ -76,7 +76,7 @@ class CardController extends Controller {
* @param int $order
* @return \OCP\AppFramework\Db\Entity
*/
public function create($title, $stackId, $type, $order=999) {
public function create($title, $stackId, $type, $order = 999) {
return $this->cardService->create($title, $stackId, $type, $order, $this->userId);
}

View File

@@ -32,7 +32,7 @@ class LabelController extends Controller {
private $labelService;
public function __construct($appName, IRequest $request, LabelService $labelService){
public function __construct($appName, IRequest $request, LabelService $labelService) {
parent::__construct($appName, $request);
$this->labelService = $labelService;
}

View File

@@ -67,8 +67,9 @@ class ShareController extends Controller {
}
$limit = 10;
foreach ($this->userManager->searchDisplayName($search, $limit, $offset) as $idx => $user) {
if ($user->getUID() === $this->userId)
if ($user->getUID() === $this->userId) {
continue;
}
$acl = new Acl();
$acl->setType('user');
$acl->setParticipant($user->getUID());

View File

@@ -33,7 +33,7 @@ use OCP\AppFramework\Controller;
class StackController extends Controller {
private $userId;
private $stackService;
public function __construct($appName, IRequest $request, StackService $cardService, $userId){
public function __construct($appName, IRequest $request, StackService $cardService, $userId) {
parent::__construct($appName, $request);
$this->userId = $userId;
$this->stackService = $cardService;
@@ -64,7 +64,7 @@ class StackController extends Controller {
* @param int $order
* @return \OCP\AppFramework\Db\Entity
*/
public function create($title, $boardId, $order=999) {
public function create($title, $boardId, $order = 999) {
return $this->stackService->create($title, $boardId, $order);
}

View File

@@ -32,7 +32,7 @@ class AclMapper extends DeckMapper implements IPermissionMapper {
parent::__construct($db, 'deck_board_acl', '\OCA\Deck\Db\Acl');
}
public function findAll($boardId, $limit=null, $offset=null) {
public function findAll($boardId, $limit = null, $offset = null) {
$sql = 'SELECT id, board_id, type, participant, permission_edit, permission_share, permission_manage FROM `*PREFIX*deck_board_acl` WHERE `board_id` = ? ';
return $this->findEntities($sql, [$boardId], $limit, $offset);
}

View File

@@ -37,9 +37,9 @@ class Board extends Entity implements JsonSerializable {
protected $shared;
public function __construct() {
$this->addType('id','integer');
$this->addType('shared','integer');
$this->addType('archived','boolean');
$this->addType('id', 'integer');
$this->addType('shared', 'integer');
$this->addType('archived', 'boolean');
$this->addRelation('labels');
$this->addRelation('acl');
$this->addRelation('shared');
@@ -55,7 +55,7 @@ class Board extends Entity implements JsonSerializable {
'labels' => $this->labels,
'acl' => $this->acl,
];
if($this->shared!==-1) {
if ($this->shared !== -1) {
$result['shared'] = $this->shared;
}
return $result;

View File

@@ -41,12 +41,12 @@ class Card extends Entity implements JsonSerializable {
protected $archived = false;
public function __construct() {
$this->addType('id','integer');
$this->addType('stackId','integer');
$this->addType('order','integer');
$this->addType('id', 'integer');
$this->addType('stackId', 'integer');
$this->addType('order', 'integer');
$this->addType('lastModified', 'integer');
$this->addType('createdAt', 'integer');
$this->addType('archived','boolean');
$this->addType('archived', 'boolean');
$this->addRelation('labels');
}

View File

@@ -50,8 +50,8 @@ class Entity extends \OCP\AppFramework\Db\Entity {
* @param string $attribute the name of the attribute
* @since 7.0.0
*/
protected function markFieldUpdated($attribute){
if(!in_array($attribute, $this->_relations)) {
protected function markFieldUpdated($attribute) {
if (!in_array($attribute, $this->_relations)) {
parent::markFieldUpdated($attribute);
}
}

View File

@@ -34,7 +34,7 @@ class Label extends Entity implements JsonSerializable {
protected $boardId;
protected $cardId;
public function __construct() {
$this->addType('id','integer');
$this->addType('id', 'integer');
}
public function jsonSerialize() {
return [

View File

@@ -32,7 +32,7 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
parent::__construct($db, 'deck_labels', '\OCA\Deck\Db\Label');
}
public function findAll($boardId, $limit=null, $offset=null) {
public function findAll($boardId, $limit = null, $offset = null) {
$sql = 'SELECT * FROM `*PREFIX*deck_labels` WHERE `board_id` = ? ORDER BY `id`';
return $this->findEntities($sql, [$boardId], $limit, $offset);
}
@@ -44,11 +44,11 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
return parent::delete($entity);
}
public function findAssignedLabelsForCard($cardId, $limit=null, $offset=null) {
public function findAssignedLabelsForCard($cardId, $limit = null, $offset = null) {
$sql = 'SELECT l.* FROM `*PREFIX*deck_assigned_labels` as al INNER JOIN *PREFIX*deck_labels as l ON l.id = al.label_id WHERE `card_id` = ? ORDER BY l.id';
return $this->findEntities($sql, [$cardId], $limit, $offset);
}
public function findAssignedLabelsForBoard($boardId, $limit=null, $offset=null) {
public function findAssignedLabelsForBoard($boardId, $limit = null, $offset = null) {
$sql = "SELECT c.id as card_id, l.id as id, l.title as title, l.color as color FROM oc_deck_cards as c " .
" INNER JOIN oc_deck_assigned_labels as al ON al.card_id = c.id INNER JOIN oc_deck_labels as l ON al.label_id = l.id WHERE board_id=? ORDER BY l.id";
$entities = $this->findEntities($sql, [$boardId], $limit, $offset);
@@ -59,7 +59,7 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
$labels = $this->findAssignedLabelsForBoard($boardId);
$result = array();
foreach ($labels as $label) {
if(!array_key_exists($label->getCardId(), $result)) {
if (!array_key_exists($label->getCardId(), $result)) {
$result[$label->getCardId()] = array();
}
$result[$label->getCardId()][] = $label;

View File

@@ -48,7 +48,7 @@ class StackMapper extends DeckMapper implements IPermissionMapper {
}
public function findAll($boardId, $limit=null, $offset=null) {
public function findAll($boardId, $limit = null, $offset = null) {
$sql = 'SELECT * FROM `*PREFIX*deck_stacks` WHERE `board_id` = ? ORDER BY `order`';
return $this->findEntities($sql, [$boardId], $limit, $offset);
}

View File

@@ -26,9 +26,9 @@ namespace OCA\Deck;
class NoPermissionException extends StatusException {
public function __construct($message, $controller=null, $method=null) {
public function __construct($message, $controller = null, $method = null) {
parent::__construct($message);
if($controller && $method) {
if ($controller && $method) {
$this->message = get_class($controller) . "#" . $method . ": " . $message;
}
}

View File

@@ -26,7 +26,7 @@ namespace OCA\Deck;
class NotFoundException extends StatusException {
public function __construct($message="") {
public function __construct($message = "") {
parent::__construct($message);
}

View File

@@ -101,8 +101,9 @@ class CardService {
$card->setLastModified(time());
}
if ($i === $order)
if ($i === $order) {
$i++;
}
if ($card->id !== $id) {
$card->setOrder($i++);

View File

@@ -26,10 +26,8 @@ namespace OCA\Deck\Service;
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\AclMapper;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\IPermissionMapper;
use OCA\Deck\NoPermissionException;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\IGroupManager;
use OCP\ILogger;

View File

@@ -54,7 +54,7 @@ class StackService {
foreach ($stacks as $stackIndex => $stack) {
$cards = $this->cardMapper->findAll($stack->id);
foreach ($cards as $cardIndex => $card) {
if(array_key_exists($card->id, $labels)) {
if (array_key_exists($card->id, $labels)) {
$cards[$cardIndex]->setLabels($labels[$card->id]);
}
}
@@ -70,7 +70,7 @@ class StackService {
foreach ($stacks as $stackIndex => $stack) {
$cards = $this->cardMapper->findAllArchived($stack->id);
foreach ($cards as $cardIndex => $card) {
if(array_key_exists($card->id, $labels)) {
if (array_key_exists($card->id, $labels)) {
$cards[$cardIndex]->setLabels($labels[$card->id]);
}
}