@@ -183,7 +183,7 @@ |
||
| 183 | 183 | * Find a list of all users (including the ones from groups) |
| 184 | 184 | * Required to allow assigning them to cards |
| 185 | 185 | * |
| 186 | - * @param $boardId |
|
| 186 | + * @param integer|null $boardId |
|
| 187 | 187 | * @return array |
| 188 | 188 | */ |
| 189 | 189 | public function findUsers($boardId) { |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function findUsers($boardId) { |
| 190 | 190 | // cache users of a board so we don't query them for every cards |
| 191 | - if (array_key_exists((string)$boardId, $this->users)) { |
|
| 192 | - return $this->users[(string)$boardId]; |
|
| 191 | + if (array_key_exists((string) $boardId, $this->users)) { |
|
| 192 | + return $this->users[(string) $boardId]; |
|
| 193 | 193 | } |
| 194 | 194 | try { |
| 195 | 195 | $board = $this->boardMapper->find($boardId); |
@@ -206,14 +206,14 @@ discard block |
||
| 206 | 206 | $user = $this->userManager->get($acl->getParticipant()); |
| 207 | 207 | $users[$user->getUID()] = new User($user); |
| 208 | 208 | } |
| 209 | - if($acl->getType() === Acl::PERMISSION_TYPE_GROUP) { |
|
| 209 | + if ($acl->getType() === Acl::PERMISSION_TYPE_GROUP) { |
|
| 210 | 210 | $group = $this->groupManager->get($acl->getParticipant()); |
| 211 | 211 | foreach ($group->getUsers() as $user) { |
| 212 | 212 | $users[$user->getUID()] = new User($user); |
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | - $this->users[(string)$boardId] = $users; |
|
| 217 | - return $this->users[(string)$boardId]; |
|
| 216 | + $this->users[(string) $boardId] = $users; |
|
| 217 | + return $this->users[(string) $boardId]; |
|
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | \ No newline at end of file |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Mark a property as relation so it will not get updated using Mapper::update |
| 35 | - * @param $property string Name of the property |
|
| 35 | + * @param string $property string Name of the property |
|
| 36 | 36 | */ |
| 37 | 37 | public function addRelation($property) { |
| 38 | 38 | if (!in_array($property, $this->_relations, true)) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Mark a property as resolvable via resolveRelation() |
| 45 | - * @param $property string Name of the property |
|
| 45 | + * @param string $property string Name of the property |
|
| 46 | 46 | */ |
| 47 | 47 | public function addResolvable($property) { |
| 48 | 48 | $this->_resolvedProperties[$property] = null; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | foreach ($this->_resolvedProperties as $property => $value) { |
| 80 | - if($value !== null) { |
|
| 80 | + if ($value !== null) { |
|
| 81 | 81 | $json[$property] = $value; |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -107,29 +107,29 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function resolveRelation($property, $resolver) { |
| 109 | 109 | $result = null; |
| 110 | - if($property !== null && $this->$property !== null) { |
|
| 110 | + if ($property !== null && $this->$property !== null) { |
|
| 111 | 111 | $result = $resolver($this->$property); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if($result instanceof RelationalObject || $result === null) { |
|
| 114 | + if ($result instanceof RelationalObject || $result === null) { |
|
| 115 | 115 | $this->_resolvedProperties[$property] = $result; |
| 116 | 116 | } else { |
| 117 | 117 | throw new \Exception('resolver must return an instance of RelationalObject'); |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - public function __call($methodName, $args){ |
|
| 122 | - $attr = lcfirst( substr($methodName, 7) ); |
|
| 123 | - if(array_key_exists($attr, $this->_resolvedProperties) && strpos($methodName, 'resolve') === 0) { |
|
| 124 | - if($this->_resolvedProperties[$attr] !== null) { |
|
| 121 | + public function __call($methodName, $args) { |
|
| 122 | + $attr = lcfirst(substr($methodName, 7)); |
|
| 123 | + if (array_key_exists($attr, $this->_resolvedProperties) && strpos($methodName, 'resolve') === 0) { |
|
| 124 | + if ($this->_resolvedProperties[$attr] !== null) { |
|
| 125 | 125 | return $this->_resolvedProperties[$attr]; |
| 126 | 126 | } |
| 127 | 127 | return $this->getter($attr); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - $attr = lcfirst( substr($methodName, 3) ); |
|
| 131 | - if(array_key_exists($attr, $this->_resolvedProperties) && strpos($methodName, 'set') === 0) { |
|
| 132 | - if(!is_scalar($args[0])) { |
|
| 130 | + $attr = lcfirst(substr($methodName, 3)); |
|
| 131 | + if (array_key_exists($attr, $this->_resolvedProperties) && strpos($methodName, 'set') === 0) { |
|
| 132 | + if (!is_scalar($args[0])) { |
|
| 133 | 133 | $args[0] = $args[0]['primaryKey']; |
| 134 | 134 | } |
| 135 | 135 | parent::setter($attr, $args); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * Send notifications that a board was shared with a user/group |
| 99 | 99 | * |
| 100 | 100 | * @param $boardId |
| 101 | - * @param $acl |
|
| 101 | + * @param Acl $acl |
|
| 102 | 102 | * @throws \InvalidArgumentException |
| 103 | 103 | */ |
| 104 | 104 | public function sendBoardShared($boardId, $acl) { |
@@ -128,6 +128,9 @@ discard block |
||
| 128 | 128 | return $this->boards[$boardId]; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | + /** |
|
| 132 | + * @param Board $board |
|
| 133 | + */ |
|
| 131 | 134 | private function generateBoardShared($board, $userId) { |
| 132 | 135 | $notification = $this->notificationManager->createNotification(); |
| 133 | 136 | $notification |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | * @throws \Exception |
| 53 | 53 | */ |
| 54 | 54 | public function getObjectSerialization() { |
| 55 | - if($this->object instanceof \JsonSerializable) { |
|
| 55 | + if ($this->object instanceof \JsonSerializable) { |
|
| 56 | 56 | $this->object->jsonSerialize(); |
| 57 | 57 | } else { |
| 58 | 58 | throw new \Exception('jsonSerialize is not implemented on ' . get_class($this)); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | public function getDuedate($isoFormat = false) { |
| 67 | - if($this->duedate === null) { |
|
| 67 | + if ($this->duedate === null) { |
|
| 68 | 68 | return null; |
| 69 | 69 | } |
| 70 | 70 | $dt = new DateTime($this->duedate); |
@@ -80,16 +80,16 @@ discard block |
||
| 80 | 80 | $due = strtotime($this->duedate); |
| 81 | 81 | |
| 82 | 82 | $today = new DateTime(); |
| 83 | - $today->setTime( 0, 0); |
|
| 83 | + $today->setTime(0, 0); |
|
| 84 | 84 | |
| 85 | 85 | $match_date = new DateTime($this->duedate); |
| 86 | 86 | |
| 87 | - $match_date->setTime( 0, 0); |
|
| 87 | + $match_date->setTime(0, 0); |
|
| 88 | 88 | |
| 89 | - $diff = $today->diff( $match_date ); |
|
| 90 | - $diffDays = (integer)$diff->format('%R%a'); // Extract days count in interval |
|
| 89 | + $diff = $today->diff($match_date); |
|
| 90 | + $diffDays = (integer) $diff->format('%R%a'); // Extract days count in interval |
|
| 91 | 91 | |
| 92 | - if($due !== false) { |
|
| 92 | + if ($due !== false) { |
|
| 93 | 93 | if ($diffDays === 1) { |
| 94 | 94 | $json['overdue'] = self::DUEDATE_NEXT; |
| 95 | 95 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | public function findToDelete() { |
| 142 | 142 | // add buffer of 5 min |
| 143 | - $timeLimit = time()-(60*5); |
|
| 143 | + $timeLimit = time() - (60 * 5); |
|
| 144 | 144 | $sql = 'SELECT id, title, owner, color, archived, deleted_at FROM `*PREFIX*deck_boards` ' . |
| 145 | 145 | 'WHERE `deleted_at` > 0 AND `deleted_at` < ?'; |
| 146 | 146 | return $this->findEntities($sql, [$timeLimit]); |
@@ -177,21 +177,21 @@ discard block |
||
| 177 | 177 | return $id; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - public function mapAcl(Acl &$acl) { |
|
| 180 | + public function mapAcl(Acl & $acl) { |
|
| 181 | 181 | $userManager = $this->userManager; |
| 182 | 182 | $groupManager = $this->groupManager; |
| 183 | 183 | $acl->resolveRelation('participant', function($participant) use (&$acl, &$userManager, &$groupManager) { |
| 184 | - if($acl->getType() === Acl::PERMISSION_TYPE_USER) { |
|
| 184 | + if ($acl->getType() === Acl::PERMISSION_TYPE_USER) { |
|
| 185 | 185 | $user = $userManager->get($participant); |
| 186 | - if($user !== null) { |
|
| 186 | + if ($user !== null) { |
|
| 187 | 187 | return new User($user); |
| 188 | 188 | } |
| 189 | 189 | \OC::$server->getLogger()->debug('User ' . $acl->getId() . ' not found when mapping acl ' . $acl->getParticipant()); |
| 190 | 190 | return null; |
| 191 | 191 | } |
| 192 | - if($acl->getType() === Acl::PERMISSION_TYPE_GROUP) { |
|
| 192 | + if ($acl->getType() === Acl::PERMISSION_TYPE_GROUP) { |
|
| 193 | 193 | $group = $groupManager->get($participant); |
| 194 | - if($group !== null) { |
|
| 194 | + if ($group !== null) { |
|
| 195 | 195 | return new Group($group); |
| 196 | 196 | } |
| 197 | 197 | \OC::$server->getLogger()->debug('Group ' . $acl->getId() . ' not found when mapping acl ' . $acl->getParticipant()); |
@@ -204,11 +204,11 @@ discard block |
||
| 204 | 204 | /** |
| 205 | 205 | * @param Board $board |
| 206 | 206 | */ |
| 207 | - public function mapOwner(Board &$board) { |
|
| 207 | + public function mapOwner(Board & $board) { |
|
| 208 | 208 | $userManager = $this->userManager; |
| 209 | 209 | $board->resolveRelation('owner', function($owner) use (&$userManager) { |
| 210 | 210 | $user = $userManager->get($owner); |
| 211 | - if($user !== null) { |
|
| 211 | + if ($user !== null) { |
|
| 212 | 212 | return new User($user); |
| 213 | 213 | } |
| 214 | 214 | return null; |