Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
@@ -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 [
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
continue;
|
||||
if ($user->getUID() === $this->userId) {
|
||||
continue;
|
||||
}
|
||||
$acl = new Acl();
|
||||
$acl->setType('user');
|
||||
$acl->setParticipant($user->getUID());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 [
|
||||
|
||||
@@ -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;
|
||||
@@ -70,14 +70,14 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
|
||||
public function deleteLabelAssignments($labelId) {
|
||||
$sql = 'DELETE FROM `*PREFIX*deck_assigned_labels` WHERE label_id = ?';
|
||||
$stmt = $this->db->prepare($sql);
|
||||
$stmt->bindParam(1, $labelId, \PDO::PARAM_INT);
|
||||
$stmt->bindParam(1, $labelId, \PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
public function deleteLabelAssignmentsForCard($cardId) {
|
||||
$sql = 'DELETE FROM `*PREFIX*deck_assigned_labels` WHERE card_id = ?';
|
||||
$stmt = $this->db->prepare($sql);
|
||||
$stmt->bindParam(1, $cardId, \PDO::PARAM_INT);
|
||||
$stmt->bindParam(1, $cardId, \PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OCA\Deck;
|
||||
|
||||
class NotFoundException extends StatusException {
|
||||
|
||||
public function __construct($message="") {
|
||||
public function __construct($message = "") {
|
||||
parent::__construct($message);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,8 +101,9 @@ class CardService {
|
||||
$card->setLastModified(time());
|
||||
}
|
||||
|
||||
if ($i === $order)
|
||||
$i++;
|
||||
if ($i === $order) {
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($card->id !== $id) {
|
||||
$card->setOrder($i++);
|
||||
|
||||
@@ -28,7 +28,7 @@ use OCA\Deck\Db\Acl;
|
||||
use OCA\Deck\Db\LabelMapper;
|
||||
|
||||
|
||||
class LabelService {
|
||||
class LabelService {
|
||||
|
||||
private $labelMapper;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -33,7 +33,7 @@ use OCA\Deck\Db\Stack;
|
||||
use OCA\Deck\Db\StackMapper;
|
||||
|
||||
|
||||
class StackService {
|
||||
class StackService {
|
||||
|
||||
private $stackMapper;
|
||||
private $cardMapper;
|
||||
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user