@@ -27,12 +27,9 @@ |
||
| 27 | 27 | use OCA\Deck\Db\AclMapper; |
| 28 | 28 | use OCA\Deck\Db\Group; |
| 29 | 29 | use OCA\Deck\Db\Label; |
| 30 | - |
|
| 31 | - |
|
| 32 | 30 | use OCA\Deck\Db\User; |
| 33 | 31 | use OCP\IGroupManager; |
| 34 | 32 | use OCP\IL10N; |
| 35 | - |
|
| 36 | 33 | use OCA\Deck\Db\Board; |
| 37 | 34 | use OCA\Deck\Db\BoardMapper; |
| 38 | 35 | use OCA\Deck\Db\LabelMapper; |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | $groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups']); |
| 63 | 63 | $complete = array_merge($userBoards, $groupBoards); |
| 64 | 64 | $result = []; |
| 65 | - foreach($complete as &$item) { |
|
| 66 | - if(!array_key_exists($item->getId(), $result)) { |
|
| 65 | + foreach ($complete as &$item) { |
|
| 66 | + if (!array_key_exists($item->getId(), $result)) { |
|
| 67 | 67 | $item = $this->mapOwner($item); |
| 68 | - if($item->getAcl() !== null) { |
|
| 68 | + if ($item->getAcl() !== null) { |
|
| 69 | 69 | foreach ($item->getAcl() as &$acl) { |
| 70 | 70 | $acl = $this->mapAcl($acl); |
| 71 | 71 | } |
@@ -81,21 +81,21 @@ discard block |
||
| 81 | 81 | $board = $this->boardMapper->find($boardId, true, true); |
| 82 | 82 | $board = $this->mapOwner($board); |
| 83 | 83 | foreach ($board->getAcl() as &$acl) { |
| 84 | - if($acl !== null) { |
|
| 84 | + if ($acl !== null) { |
|
| 85 | 85 | $this->mapAcl($acl); |
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | return $board; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - private function mapAcl(Acl &$acl) { |
|
| 91 | + private function mapAcl(Acl & $acl) { |
|
| 92 | 92 | $userManager = $this->userManager; |
| 93 | 93 | $groupManager = $this->groupManager; |
| 94 | 94 | $acl->resolveRelation('participant', function($participant) use (&$acl, &$userManager, &$groupManager) { |
| 95 | - if($acl->getType() === Acl::PERMISSION_TYPE_USER) { |
|
| 95 | + if ($acl->getType() === Acl::PERMISSION_TYPE_USER) { |
|
| 96 | 96 | return new User($userManager->get($acl->getParticipant($participant))); |
| 97 | 97 | } |
| 98 | - if($acl->getType() === Acl::PERMISSION_TYPE_GROUP) { |
|
| 98 | + if ($acl->getType() === Acl::PERMISSION_TYPE_GROUP) { |
|
| 99 | 99 | return new Group($groupManager->get($acl->getParticipant($participant))); |
| 100 | 100 | } |
| 101 | 101 | }); |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | * @return array |
| 56 | 56 | */ |
| 57 | 57 | public function searchUser($search) { |
| 58 | - if($search==='%') { |
|
| 58 | + if ($search === '%') { |
|
| 59 | 59 | $search = ''; |
| 60 | 60 | } |
| 61 | 61 | $limit = 5; |
@@ -83,30 +83,30 @@ |
||
| 83 | 83 | */ |
| 84 | 84 | public function resolveRelation($property, $resolver) { |
| 85 | 85 | $result = null; |
| 86 | - if($property !== null && $this->$property !== null) { |
|
| 86 | + if ($property !== null && $this->$property !== null) { |
|
| 87 | 87 | $result = $resolver($this->$property); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if($result instanceof RelationalObject || $result === null) { |
|
| 90 | + if ($result instanceof RelationalObject || $result === null) { |
|
| 91 | 91 | $this->_resolvedProperties[$property] = $result; |
| 92 | 92 | } else { |
| 93 | 93 | throw new \Exception('resolver must return an instance of RelationalObject'); |
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - public function __call($methodName, $args){ |
|
| 98 | - $attr = lcfirst( substr($methodName, 7) ); |
|
| 99 | - if(strpos($methodName, 'resolve') === 0 && array_key_exists($attr, $this->_resolvedProperties)) { |
|
| 100 | - if($this->_resolvedProperties[$attr] !== null) { |
|
| 97 | + public function __call($methodName, $args) { |
|
| 98 | + $attr = lcfirst(substr($methodName, 7)); |
|
| 99 | + if (strpos($methodName, 'resolve') === 0 && array_key_exists($attr, $this->_resolvedProperties)) { |
|
| 100 | + if ($this->_resolvedProperties[$attr] !== null) { |
|
| 101 | 101 | return $this->_resolvedProperties[$attr]; |
| 102 | 102 | } else { |
| 103 | 103 | return $this->getter($attr); |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - $attr = lcfirst( substr($methodName, 3) ); |
|
| 108 | - if(strpos($methodName, 'set') === 0 && array_key_exists($attr, $this->_resolvedProperties)) { |
|
| 109 | - if(!is_scalar($args[0])) { |
|
| 107 | + $attr = lcfirst(substr($methodName, 3)); |
|
| 108 | + if (strpos($methodName, 'set') === 0 && array_key_exists($attr, $this->_resolvedProperties)) { |
|
| 109 | + if (!is_scalar($args[0])) { |
|
| 110 | 110 | $args[0] = $args[0]['primaryKey']; |
| 111 | 111 | } |
| 112 | 112 | return 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)); |