@@ -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 |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $notification = $this->notificationManager->createNotification(); |
84 | 84 | $notification |
85 | 85 | ->setApp('deck') |
86 | - ->setUser((string)$user->getUID()) |
|
86 | + ->setUser((string) $user->getUID()) |
|
87 | 87 | ->setObject('card', $card->getId()) |
88 | 88 | ->setSubject('card-overdue', [ |
89 | 89 | $card->getTitle(), $board->getTitle() |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $notification = $this->notificationManager->createNotification(); |
133 | 133 | $notification |
134 | 134 | ->setApp('deck') |
135 | - ->setUser((string)$userId) |
|
135 | + ->setUser((string) $userId) |
|
136 | 136 | ->setDateTime(new DateTime()) |
137 | 137 | ->setObject('board', $board->getId()) |
138 | 138 | ->setSubject('board-shared', [$board->getTitle(), $this->currentUser]); |
@@ -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 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | * Check if user exists before assigning it to a card |
64 | 64 | * |
65 | 65 | * @param Entity $entity |
66 | - * @return null|Entity |
|
66 | + * @return AssignedUsers|null |
|
67 | 67 | */ |
68 | 68 | public function insert(Entity $entity) { |
69 | 69 | $user = $this->userManager->get($entity->getParticipant()); |
@@ -80,7 +80,7 @@ |
||
80 | 80 | $userManager = $this->userManager; |
81 | 81 | $assignment->resolveRelation('participant', function() use (&$userManager, &$assignment) { |
82 | 82 | $user = $userManager->get($assignment->getParticipant()); |
83 | - if($user !== null) { |
|
83 | + if ($user !== null) { |
|
84 | 84 | return new User($user); |
85 | 85 | } |
86 | 86 | return null; |
@@ -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]); |
@@ -181,17 +181,17 @@ discard block |
||
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()); |
@@ -208,7 +208,7 @@ discard block |
||
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; |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | $groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups']); |
70 | 70 | $complete = array_merge($userBoards, $groupBoards); |
71 | 71 | $result = []; |
72 | - foreach($complete as &$item) { |
|
73 | - if(!array_key_exists($item->getId(), $result)) { |
|
72 | + foreach ($complete as &$item) { |
|
73 | + if (!array_key_exists($item->getId(), $result)) { |
|
74 | 74 | $this->boardMapper->mapOwner($item); |
75 | - if($item->getAcl() !== null) { |
|
75 | + if ($item->getAcl() !== null) { |
|
76 | 76 | foreach ($item->getAcl() as &$acl) { |
77 | 77 | $this->boardMapper->mapAcl($acl); |
78 | 78 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $board = $this->boardMapper->find($boardId, true, true); |
97 | 97 | $this->boardMapper->mapOwner($board); |
98 | 98 | foreach ($board->getAcl() as &$acl) { |
99 | - if($acl !== null) { |
|
99 | + if ($acl !== null) { |
|
100 | 100 | $this->boardMapper->mapAcl($acl); |
101 | 101 | } |
102 | 102 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $this->boardMapper->mapAcl($acl); |
250 | 250 | if ($acl->getType() === Acl::PERMISSION_TYPE_USER) { |
251 | 251 | $assignements = $this->assignedUsersMapper->findByUserId($acl->getParticipant()); |
252 | - foreach($assignements as $assignement) { |
|
252 | + foreach ($assignements as $assignement) { |
|
253 | 253 | $this->assignedUsersMapper->delete($assignement); |
254 | 254 | } |
255 | 255 | } |