@@ -60,7 +60,7 @@ |
||
| 60 | 60 | */ |
| 61 | 61 | public function afterException($controller, $methodName, \Exception $exception) { |
| 62 | 62 | if ($exception instanceof StatusException) { |
| 63 | - if($this->config->getSystemValue('loglevel', Util::WARN) === Util::DEBUG) { |
|
| 63 | + if ($this->config->getSystemValue('loglevel', Util::WARN) === Util::DEBUG) { |
|
| 64 | 64 | $this->logger->logException($exception); |
| 65 | 65 | } |
| 66 | 66 | return new JSONResponse([ |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Mark a property as relation so it will not get updated using Mapper::update |
| 33 | - * @param $property string Name of the property |
|
| 33 | + * @param string $property string Name of the property |
|
| 34 | 34 | */ |
| 35 | 35 | public function addRelation($property) { |
| 36 | 36 | if (!in_array($property, $this->_relations)) { |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * Mark a property as resolvable via resolveRelation() |
| 43 | - * @param $property string Name of the property |
|
| 43 | + * @param string $property string Name of the property |
|
| 44 | 44 | */ |
| 45 | 45 | public function addResolvable($property) { |
| 46 | 46 | $this->_resolvedProperties[$property] = null; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | foreach ($this->_resolvedProperties as $property => $value) { |
| 79 | - if($value !== null) { |
|
| 79 | + if ($value !== null) { |
|
| 80 | 80 | $json[$property] = $value; |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -106,30 +106,30 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function resolveRelation($property, $resolver) { |
| 108 | 108 | $result = null; |
| 109 | - if($property !== null && $this->$property !== null) { |
|
| 109 | + if ($property !== null && $this->$property !== null) { |
|
| 110 | 110 | $result = $resolver($this->$property); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if($result instanceof RelationalObject || $result === null) { |
|
| 113 | + if ($result instanceof RelationalObject || $result === null) { |
|
| 114 | 114 | $this->_resolvedProperties[$property] = $result; |
| 115 | 115 | } else { |
| 116 | 116 | throw new \Exception('resolver must return an instance of RelationalObject'); |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - public function __call($methodName, $args){ |
|
| 121 | - $attr = lcfirst( substr($methodName, 7) ); |
|
| 122 | - if(strpos($methodName, 'resolve') === 0 && array_key_exists($attr, $this->_resolvedProperties)) { |
|
| 123 | - if($this->_resolvedProperties[$attr] !== null) { |
|
| 120 | + public function __call($methodName, $args) { |
|
| 121 | + $attr = lcfirst(substr($methodName, 7)); |
|
| 122 | + if (strpos($methodName, 'resolve') === 0 && array_key_exists($attr, $this->_resolvedProperties)) { |
|
| 123 | + if ($this->_resolvedProperties[$attr] !== null) { |
|
| 124 | 124 | return $this->_resolvedProperties[$attr]; |
| 125 | 125 | } else { |
| 126 | 126 | return $this->getter($attr); |
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - $attr = lcfirst( substr($methodName, 3) ); |
|
| 131 | - if(strpos($methodName, 'set') === 0 && array_key_exists($attr, $this->_resolvedProperties)) { |
|
| 132 | - if(!is_scalar($args[0])) { |
|
| 130 | + $attr = lcfirst(substr($methodName, 3)); |
|
| 131 | + if (strpos($methodName, 'set') === 0 && array_key_exists($attr, $this->_resolvedProperties)) { |
|
| 132 | + if (!is_scalar($args[0])) { |
|
| 133 | 133 | $args[0] = $args[0]['primaryKey']; |
| 134 | 134 | } |
| 135 | 135 | parent::setter($attr, $args); |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | * This method should be overwritten if object doesn't implement \JsonSerializable |
| 50 | 50 | */ |
| 51 | 51 | public function getObjectSerialization() { |
| 52 | - if($this->object instanceof \JsonSerializable) { |
|
| 52 | + if ($this->object instanceof \JsonSerializable) { |
|
| 53 | 53 | $this->object->jsonSerialize(); |
| 54 | 54 | } else { |
| 55 | 55 | throw new \Exception('jsonSerialize is not implemented on ' . get_class($this)); |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | $groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups']); |
| 54 | 54 | $complete = array_merge($userBoards, $groupBoards); |
| 55 | 55 | $result = []; |
| 56 | - foreach($complete as &$item) { |
|
| 57 | - if(!array_key_exists($item->getId(), $result)) { |
|
| 56 | + foreach ($complete as &$item) { |
|
| 57 | + if (!array_key_exists($item->getId(), $result)) { |
|
| 58 | 58 | $this->boardMapper->mapOwner($item); |
| 59 | - if($item->getAcl() !== null) { |
|
| 59 | + if ($item->getAcl() !== null) { |
|
| 60 | 60 | foreach ($item->getAcl() as &$acl) { |
| 61 | 61 | $this->boardMapper->mapAcl($acl); |
| 62 | 62 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $board = $this->boardMapper->find($boardId, true, true); |
| 74 | 74 | $this->boardMapper->mapOwner($board); |
| 75 | 75 | foreach ($board->getAcl() as &$acl) { |
| 76 | - if($acl !== null) { |
|
| 76 | + if ($acl !== null) { |
|
| 77 | 77 | $this->boardMapper->mapAcl($acl); |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -23,7 +23,6 @@ |
||
| 23 | 23 | |
| 24 | 24 | namespace OCA\Deck\Service; |
| 25 | 25 | |
| 26 | -use OCA\Deck\ArchivedItemException; |
|
| 27 | 26 | use OCA\Deck\Db\Acl; |
| 28 | 27 | use OCA\Deck\Db\AclMapper; |
| 29 | 28 | use OCA\Deck\Db\IPermissionMapper; |
@@ -64,15 +64,15 @@ |
||
| 64 | 64 | $acls = $this->aclMapper->findAll($board->getId()); |
| 65 | 65 | /** @var Acl $acl */ |
| 66 | 66 | foreach ($acls as $acl) { |
| 67 | - if($acl->getType() === Acl::PERMISSION_TYPE_USER) { |
|
| 67 | + if ($acl->getType() === Acl::PERMISSION_TYPE_USER) { |
|
| 68 | 68 | $user = $this->userManager->get($acl->getParticipant()); |
| 69 | - if($user === null) { |
|
| 69 | + if ($user === null) { |
|
| 70 | 70 | $this->aclMapper->delete($acl); |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | - if($acl->getType() === Acl::PERMISSION_TYPE_GROUP) { |
|
| 73 | + if ($acl->getType() === Acl::PERMISSION_TYPE_GROUP) { |
|
| 74 | 74 | $group = $this->groupManager->get($acl->getParticipant()); |
| 75 | - if($group === null) { |
|
| 75 | + if ($group === null) { |
|
| 76 | 76 | $this->aclMapper->delete($acl); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -28,7 +28,6 @@ |
||
| 28 | 28 | use OCP\AppFramework\App; |
| 29 | 29 | use OCA\Deck\Middleware\SharingMiddleware; |
| 30 | 30 | use OCP\IGroup; |
| 31 | -use OCP\IGroupManager; |
|
| 32 | 31 | use OCP\IUser; |
| 33 | 32 | use OCP\IUserManager; |
| 34 | 33 | |
@@ -129,11 +129,11 @@ |
||
| 129 | 129 | return $row['id']; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - public function mapOwner(Card &$card) { |
|
| 132 | + public function mapOwner(Card & $card) { |
|
| 133 | 133 | $userManager = $this->userManager; |
| 134 | 134 | $card->resolveRelation('owner', function($owner) use (&$userManager) { |
| 135 | 135 | $user = $userManager->get($owner); |
| 136 | - if($user !== null) { |
|
| 136 | + if ($user !== null) { |
|
| 137 | 137 | return new User($user); |
| 138 | 138 | } |
| 139 | 139 | return null; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | public function create($title, $boardId, $order) { |
| 86 | 86 | $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE); |
| 87 | - if($this->boardService->isArchived(null, $boardId)) { |
|
| 87 | + if ($this->boardService->isArchived(null, $boardId)) { |
|
| 88 | 88 | throw new StatusException('Operation not allowed. This board is archived.'); |
| 89 | 89 | } |
| 90 | 90 | $stack = new Stack(); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | public function update($id, $title, $boardId, $order) { |
| 104 | 104 | $this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE); |
| 105 | - if($this->boardService->isArchived($this->stackMapper, $id)) { |
|
| 105 | + if ($this->boardService->isArchived($this->stackMapper, $id)) { |
|
| 106 | 106 | throw new StatusException('Operation not allowed. This board is archived.'); |
| 107 | 107 | } |
| 108 | 108 | $stack = $this->stackMapper->find($id); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | public function create($title, $color, $boardId) { |
| 53 | 53 | $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE); |
| 54 | - if($this->boardService->isArchived(null, $boardId)) { |
|
| 54 | + if ($this->boardService->isArchived(null, $boardId)) { |
|
| 55 | 55 | throw new StatusException('Operation not allowed. This board is archived.'); |
| 56 | 56 | } |
| 57 | 57 | $label = new Label(); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | public function delete($id) { |
| 65 | 65 | $this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE); |
| 66 | - if($this->boardService->isArchived($this->labelMapper, $id)) { |
|
| 66 | + if ($this->boardService->isArchived($this->labelMapper, $id)) { |
|
| 67 | 67 | throw new StatusException('Operation not allowed. This board is archived.'); |
| 68 | 68 | } |
| 69 | 69 | return $this->labelMapper->delete($this->find($id)); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function update($id, $title, $color) { |
| 73 | 73 | $this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE); |
| 74 | - if($this->boardService->isArchived($this->labelMapper, $id)) { |
|
| 74 | + if ($this->boardService->isArchived($this->labelMapper, $id)) { |
|
| 75 | 75 | throw new StatusException('Operation not allowed. This board is archived.'); |
| 76 | 76 | } |
| 77 | 77 | $label = $this->find($id); |