@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @return string|null Either the value or null |
98 | 98 | */ |
99 | 99 | public function get($key) { |
100 | - if(isset($this->sessionValues[$key])) { |
|
100 | + if (isset($this->sessionValues[$key])) { |
|
101 | 101 | return $this->sessionValues[$key]; |
102 | 102 | } |
103 | 103 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * Close the session and release the lock, also writes all changed data in batch |
160 | 160 | */ |
161 | 161 | public function close() { |
162 | - if($this->isModified) { |
|
162 | + if ($this->isModified) { |
|
163 | 163 | $encryptedValue = $this->crypto->encrypt(json_encode($this->sessionValues), $this->passphrase); |
164 | 164 | $this->session->set(self::encryptedSessionName, $encryptedValue); |
165 | 165 | $this->isModified = false; |
@@ -81,7 +81,7 @@ |
||
81 | 81 | // FIXME: Required for CI |
82 | 82 | if (!defined('PHPUNIT_RUN')) { |
83 | 83 | $webRoot = \OC::$WEBROOT; |
84 | - if($webRoot === '') { |
|
84 | + if ($webRoot === '') { |
|
85 | 85 | $webRoot = '/'; |
86 | 86 | } |
87 | 87 | setcookie(self::COOKIE_NAME, $this->passphrase, 0, $webRoot, '', $secureCookie, true); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * the comments database scheme |
52 | 52 | */ |
53 | 53 | public function __construct(array $data = null) { |
54 | - if(is_array($data)) { |
|
54 | + if (is_array($data)) { |
|
55 | 55 | $this->fromArray($data); |
56 | 56 | } |
57 | 57 | } |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | * @since 9.0.0 |
85 | 85 | */ |
86 | 86 | public function setId($id) { |
87 | - if(!is_string($id)) { |
|
87 | + if (!is_string($id)) { |
|
88 | 88 | throw new \InvalidArgumentException('String expected.'); |
89 | 89 | } |
90 | 90 | |
91 | 91 | $id = trim($id); |
92 | - if($this->data['id'] === '' || ($this->data['id'] !== '' && $id === '')) { |
|
92 | + if ($this->data['id'] === '' || ($this->data['id'] !== '' && $id === '')) { |
|
93 | 93 | $this->data['id'] = $id; |
94 | 94 | return $this; |
95 | 95 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @since 9.0.0 |
116 | 116 | */ |
117 | 117 | public function setParentId($parentId) { |
118 | - if(!is_string($parentId)) { |
|
118 | + if (!is_string($parentId)) { |
|
119 | 119 | throw new \InvalidArgumentException('String expected.'); |
120 | 120 | } |
121 | 121 | $this->data['parentId'] = trim($parentId); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @since 9.0.0 |
142 | 142 | */ |
143 | 143 | public function setTopmostParentId($id) { |
144 | - if(!is_string($id)) { |
|
144 | + if (!is_string($id)) { |
|
145 | 145 | throw new \InvalidArgumentException('String expected.'); |
146 | 146 | } |
147 | 147 | $this->data['topmostParentId'] = trim($id); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @since 9.0.0 |
167 | 167 | */ |
168 | 168 | public function setChildrenCount($count) { |
169 | - if(!is_int($count)) { |
|
169 | + if (!is_int($count)) { |
|
170 | 170 | throw new \InvalidArgumentException('Integer expected.'); |
171 | 171 | } |
172 | 172 | $this->data['childrenCount'] = $count; |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | * @since 9.0.0 |
193 | 193 | */ |
194 | 194 | public function setMessage($message) { |
195 | - if(!is_string($message)) { |
|
195 | + if (!is_string($message)) { |
|
196 | 196 | throw new \InvalidArgumentException('String expected.'); |
197 | 197 | } |
198 | 198 | $message = trim($message); |
199 | - if(mb_strlen($message, 'UTF-8') > IComment::MAX_MESSAGE_LENGTH) { |
|
200 | - throw new MessageTooLongException('Comment message must not exceed ' . IComment::MAX_MESSAGE_LENGTH . ' characters'); |
|
199 | + if (mb_strlen($message, 'UTF-8') > IComment::MAX_MESSAGE_LENGTH) { |
|
200 | + throw new MessageTooLongException('Comment message must not exceed '.IComment::MAX_MESSAGE_LENGTH.' characters'); |
|
201 | 201 | } |
202 | 202 | $this->data['message'] = $message; |
203 | 203 | return $this; |
@@ -225,14 +225,14 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function getMentions() { |
227 | 227 | $ok = preg_match_all('/\B@[a-z0-9_\-@\.\']+/i', $this->getMessage(), $mentions); |
228 | - if(!$ok || !isset($mentions[0]) || !is_array($mentions[0])) { |
|
228 | + if (!$ok || !isset($mentions[0]) || !is_array($mentions[0])) { |
|
229 | 229 | return []; |
230 | 230 | } |
231 | 231 | $uids = array_unique($mentions[0]); |
232 | 232 | $result = []; |
233 | 233 | foreach ($uids as $uid) { |
234 | 234 | // exclude author, no self-mentioning |
235 | - if($uid === '@' . $this->getActorId()) { |
|
235 | + if ($uid === '@'.$this->getActorId()) { |
|
236 | 236 | continue; |
237 | 237 | } |
238 | 238 | $result[] = ['type' => 'user', 'id' => substr($uid, 1)]; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @since 9.0.0 |
259 | 259 | */ |
260 | 260 | public function setVerb($verb) { |
261 | - if(!is_string($verb) || !trim($verb)) { |
|
261 | + if (!is_string($verb) || !trim($verb)) { |
|
262 | 262 | throw new \InvalidArgumentException('Non-empty String expected.'); |
263 | 263 | } |
264 | 264 | $this->data['verb'] = trim($verb); |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | * @since 9.0.0 |
295 | 295 | */ |
296 | 296 | public function setActor($actorType, $actorId) { |
297 | - if( |
|
297 | + if ( |
|
298 | 298 | !is_string($actorType) || !trim($actorType) |
299 | - || !is_string($actorId) || !trim($actorId) |
|
299 | + || !is_string($actorId) || !trim($actorId) |
|
300 | 300 | ) { |
301 | 301 | throw new \InvalidArgumentException('String expected.'); |
302 | 302 | } |
@@ -380,9 +380,9 @@ discard block |
||
380 | 380 | * @since 9.0.0 |
381 | 381 | */ |
382 | 382 | public function setObject($objectType, $objectId) { |
383 | - if( |
|
383 | + if ( |
|
384 | 384 | !is_string($objectType) || !trim($objectType) |
385 | - || !is_string($objectId) || !trim($objectId) |
|
385 | + || !is_string($objectId) || !trim($objectId) |
|
386 | 386 | ) { |
387 | 387 | throw new \InvalidArgumentException('String expected.'); |
388 | 388 | } |
@@ -399,20 +399,20 @@ discard block |
||
399 | 399 | * @return IComment |
400 | 400 | */ |
401 | 401 | protected function fromArray($data) { |
402 | - foreach(array_keys($data) as $key) { |
|
402 | + foreach (array_keys($data) as $key) { |
|
403 | 403 | // translate DB keys to internal setter names |
404 | - $setter = 'set' . implode('', array_map('ucfirst', explode('_', $key))); |
|
404 | + $setter = 'set'.implode('', array_map('ucfirst', explode('_', $key))); |
|
405 | 405 | $setter = str_replace('Timestamp', 'DateTime', $setter); |
406 | 406 | |
407 | - if(method_exists($this, $setter)) { |
|
407 | + if (method_exists($this, $setter)) { |
|
408 | 408 | $this->$setter($data[$key]); |
409 | 409 | } |
410 | 410 | } |
411 | 411 | |
412 | - foreach(['actor', 'object'] as $role) { |
|
413 | - if(isset($data[$role . '_type']) && isset($data[$role . '_id'])) { |
|
414 | - $setter = 'set' . ucfirst($role); |
|
415 | - $this->$setter($data[$role . '_type'], $data[$role . '_id']); |
|
412 | + foreach (['actor', 'object'] as $role) { |
|
413 | + if (isset($data[$role.'_type']) && isset($data[$role.'_id'])) { |
|
414 | + $setter = 'set'.ucfirst($role); |
|
415 | + $this->$setter($data[$role.'_type'], $data[$role.'_id']); |
|
416 | 416 | } |
417 | 417 | } |
418 | 418 |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @throws \UnexpectedValueException |
105 | 105 | */ |
106 | 106 | protected function prepareCommentForDatabaseWrite(IComment $comment) { |
107 | - if( !$comment->getActorType() |
|
107 | + if (!$comment->getActorType() |
|
108 | 108 | || !$comment->getActorId() |
109 | 109 | || !$comment->getObjectType() |
110 | 110 | || !$comment->getObjectId() |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | throw new \UnexpectedValueException('Actor, Object and Verb information must be provided for saving'); |
114 | 114 | } |
115 | 115 | |
116 | - if($comment->getId() === '') { |
|
116 | + if ($comment->getId() === '') { |
|
117 | 117 | $comment->setChildrenCount(0); |
118 | 118 | $comment->setLatestChildDateTime(new \DateTime('0000-00-00 00:00:00', new \DateTimeZone('UTC'))); |
119 | 119 | $comment->setLatestChildDateTime(null); |
120 | 120 | } |
121 | 121 | |
122 | - if(is_null($comment->getCreationDateTime())) { |
|
122 | + if (is_null($comment->getCreationDateTime())) { |
|
123 | 123 | $comment->setCreationDateTime(new \DateTime()); |
124 | 124 | } |
125 | 125 | |
126 | - if($comment->getParentId() !== '0') { |
|
126 | + if ($comment->getParentId() !== '0') { |
|
127 | 127 | $comment->setTopmostParentId($this->determineTopmostParentId($comment->getParentId())); |
128 | 128 | } else { |
129 | 129 | $comment->setTopmostParentId('0'); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | protected function determineTopmostParentId($id) { |
145 | 145 | $comment = $this->get($id); |
146 | - if($comment->getParentId() === '0') { |
|
146 | + if ($comment->getParentId() === '0') { |
|
147 | 147 | return $comment->getId(); |
148 | 148 | } else { |
149 | 149 | return $this->determineTopmostParentId($comment->getId()); |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | * @throws \InvalidArgumentException |
186 | 186 | */ |
187 | 187 | protected function checkRoleParameters($role, $type, $id) { |
188 | - if( |
|
188 | + if ( |
|
189 | 189 | !is_string($type) || empty($type) |
190 | 190 | || !is_string($id) || empty($id) |
191 | 191 | ) { |
192 | - throw new \InvalidArgumentException($role . ' parameters must be string and not empty'); |
|
192 | + throw new \InvalidArgumentException($role.' parameters must be string and not empty'); |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | protected function cache(IComment $comment) { |
202 | 202 | $id = $comment->getId(); |
203 | - if(empty($id)) { |
|
203 | + if (empty($id)) { |
|
204 | 204 | return; |
205 | 205 | } |
206 | 206 | $this->commentsCache[strval($id)] = $comment; |
@@ -228,11 +228,11 @@ discard block |
||
228 | 228 | * @since 9.0.0 |
229 | 229 | */ |
230 | 230 | public function get($id) { |
231 | - if(intval($id) === 0) { |
|
231 | + if (intval($id) === 0) { |
|
232 | 232 | throw new \InvalidArgumentException('IDs must be translatable to a number in this implementation.'); |
233 | 233 | } |
234 | 234 | |
235 | - if(isset($this->commentsCache[$id])) { |
|
235 | + if (isset($this->commentsCache[$id])) { |
|
236 | 236 | return $this->commentsCache[$id]; |
237 | 237 | } |
238 | 238 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | |
246 | 246 | $data = $resultStatement->fetch(); |
247 | 247 | $resultStatement->closeCursor(); |
248 | - if(!$data) { |
|
248 | + if (!$data) { |
|
249 | 249 | throw new NotFoundException(); |
250 | 250 | } |
251 | 251 | |
@@ -295,15 +295,15 @@ discard block |
||
295 | 295 | ->orderBy('creation_timestamp', 'DESC') |
296 | 296 | ->setParameter('id', $id); |
297 | 297 | |
298 | - if($limit > 0) { |
|
298 | + if ($limit > 0) { |
|
299 | 299 | $query->setMaxResults($limit); |
300 | 300 | } |
301 | - if($offset > 0) { |
|
301 | + if ($offset > 0) { |
|
302 | 302 | $query->setFirstResult($offset); |
303 | 303 | } |
304 | 304 | |
305 | 305 | $resultStatement = $query->execute(); |
306 | - while($data = $resultStatement->fetch()) { |
|
306 | + while ($data = $resultStatement->fetch()) { |
|
307 | 307 | $comment = new Comment($this->normalizeDatabaseData($data)); |
308 | 308 | $this->cache($comment); |
309 | 309 | $tree['replies'][] = [ |
@@ -349,20 +349,20 @@ discard block |
||
349 | 349 | ->setParameter('type', $objectType) |
350 | 350 | ->setParameter('id', $objectId); |
351 | 351 | |
352 | - if($limit > 0) { |
|
352 | + if ($limit > 0) { |
|
353 | 353 | $query->setMaxResults($limit); |
354 | 354 | } |
355 | - if($offset > 0) { |
|
355 | + if ($offset > 0) { |
|
356 | 356 | $query->setFirstResult($offset); |
357 | 357 | } |
358 | - if(!is_null($notOlderThan)) { |
|
358 | + if (!is_null($notOlderThan)) { |
|
359 | 359 | $query |
360 | 360 | ->andWhere($qb->expr()->gt('creation_timestamp', $qb->createParameter('notOlderThan'))) |
361 | 361 | ->setParameter('notOlderThan', $notOlderThan, 'datetime'); |
362 | 362 | } |
363 | 363 | |
364 | 364 | $resultStatement = $query->execute(); |
365 | - while($data = $resultStatement->fetch()) { |
|
365 | + while ($data = $resultStatement->fetch()) { |
|
366 | 366 | $comment = new Comment($this->normalizeDatabaseData($data)); |
367 | 367 | $this->cache($comment); |
368 | 368 | $comments[] = $comment; |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | ->setParameter('type', $objectType) |
390 | 390 | ->setParameter('id', $objectId); |
391 | 391 | |
392 | - if(!is_null($notOlderThan)) { |
|
392 | + if (!is_null($notOlderThan)) { |
|
393 | 393 | $query |
394 | 394 | ->andWhere($qb->expr()->gt('creation_timestamp', $qb->createParameter('notOlderThan'))) |
395 | 395 | ->setParameter('notOlderThan', $notOlderThan, 'datetime'); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * @since 9.0.0 |
434 | 434 | */ |
435 | 435 | public function delete($id) { |
436 | - if(!is_string($id)) { |
|
436 | + if (!is_string($id)) { |
|
437 | 437 | throw new \InvalidArgumentException('Parameter must be string'); |
438 | 438 | } |
439 | 439 | |
@@ -481,13 +481,13 @@ discard block |
||
481 | 481 | * @since 9.0.0 |
482 | 482 | */ |
483 | 483 | public function save(IComment $comment) { |
484 | - if($this->prepareCommentForDatabaseWrite($comment)->getId() === '') { |
|
484 | + if ($this->prepareCommentForDatabaseWrite($comment)->getId() === '') { |
|
485 | 485 | $result = $this->insert($comment); |
486 | 486 | } else { |
487 | 487 | $result = $this->update($comment); |
488 | 488 | } |
489 | 489 | |
490 | - if($result && !!$comment->getParentId()) { |
|
490 | + if ($result && !!$comment->getParentId()) { |
|
491 | 491 | $this->updateChildrenInformation( |
492 | 492 | $comment->getParentId(), |
493 | 493 | $comment->getCreationDateTime() |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | * @param IComment $comment |
505 | 505 | * @return bool |
506 | 506 | */ |
507 | - protected function insert(IComment &$comment) { |
|
507 | + protected function insert(IComment & $comment) { |
|
508 | 508 | $qb = $this->dbConn->getQueryBuilder(); |
509 | 509 | $affectedRows = $qb |
510 | 510 | ->insert('comments') |
@@ -548,22 +548,22 @@ discard block |
||
548 | 548 | $qb = $this->dbConn->getQueryBuilder(); |
549 | 549 | $affectedRows = $qb |
550 | 550 | ->update('comments') |
551 | - ->set('parent_id', $qb->createNamedParameter($comment->getParentId())) |
|
552 | - ->set('topmost_parent_id', $qb->createNamedParameter($comment->getTopmostParentId())) |
|
553 | - ->set('children_count', $qb->createNamedParameter($comment->getChildrenCount())) |
|
554 | - ->set('actor_type', $qb->createNamedParameter($comment->getActorType())) |
|
555 | - ->set('actor_id', $qb->createNamedParameter($comment->getActorId())) |
|
556 | - ->set('message', $qb->createNamedParameter($comment->getMessage())) |
|
557 | - ->set('verb', $qb->createNamedParameter($comment->getVerb())) |
|
558 | - ->set('creation_timestamp', $qb->createNamedParameter($comment->getCreationDateTime(), 'datetime')) |
|
559 | - ->set('latest_child_timestamp', $qb->createNamedParameter($comment->getLatestChildDateTime(), 'datetime')) |
|
560 | - ->set('object_type', $qb->createNamedParameter($comment->getObjectType())) |
|
561 | - ->set('object_id', $qb->createNamedParameter($comment->getObjectId())) |
|
551 | + ->set('parent_id', $qb->createNamedParameter($comment->getParentId())) |
|
552 | + ->set('topmost_parent_id', $qb->createNamedParameter($comment->getTopmostParentId())) |
|
553 | + ->set('children_count', $qb->createNamedParameter($comment->getChildrenCount())) |
|
554 | + ->set('actor_type', $qb->createNamedParameter($comment->getActorType())) |
|
555 | + ->set('actor_id', $qb->createNamedParameter($comment->getActorId())) |
|
556 | + ->set('message', $qb->createNamedParameter($comment->getMessage())) |
|
557 | + ->set('verb', $qb->createNamedParameter($comment->getVerb())) |
|
558 | + ->set('creation_timestamp', $qb->createNamedParameter($comment->getCreationDateTime(), 'datetime')) |
|
559 | + ->set('latest_child_timestamp', $qb->createNamedParameter($comment->getLatestChildDateTime(), 'datetime')) |
|
560 | + ->set('object_type', $qb->createNamedParameter($comment->getObjectType())) |
|
561 | + ->set('object_id', $qb->createNamedParameter($comment->getObjectId())) |
|
562 | 562 | ->where($qb->expr()->eq('id', $qb->createParameter('id'))) |
563 | 563 | ->setParameter('id', $comment->getId()) |
564 | 564 | ->execute(); |
565 | 565 | |
566 | - if($affectedRows === 0) { |
|
566 | + if ($affectedRows === 0) { |
|
567 | 567 | throw new NotFoundException('Comment to update does ceased to exist'); |
568 | 568 | } |
569 | 569 | |
@@ -587,8 +587,8 @@ discard block |
||
587 | 587 | $qb = $this->dbConn->getQueryBuilder(); |
588 | 588 | $affectedRows = $qb |
589 | 589 | ->update('comments') |
590 | - ->set('actor_type', $qb->createNamedParameter(ICommentsManager::DELETED_USER)) |
|
591 | - ->set('actor_id', $qb->createNamedParameter(ICommentsManager::DELETED_USER)) |
|
590 | + ->set('actor_type', $qb->createNamedParameter(ICommentsManager::DELETED_USER)) |
|
591 | + ->set('actor_id', $qb->createNamedParameter(ICommentsManager::DELETED_USER)) |
|
592 | 592 | ->where($qb->expr()->eq('actor_type', $qb->createParameter('type'))) |
593 | 593 | ->andWhere($qb->expr()->eq('actor_id', $qb->createParameter('id'))) |
594 | 594 | ->setParameter('type', $actorType) |
@@ -671,10 +671,10 @@ discard block |
||
671 | 671 | // Strategy: try to update, if this does not return affected rows, do an insert. |
672 | 672 | $affectedRows = $qb |
673 | 673 | ->update('comments_read_markers') |
674 | - ->set('user_id', $values['user_id']) |
|
674 | + ->set('user_id', $values['user_id']) |
|
675 | 675 | ->set('marker_datetime', $values['marker_datetime']) |
676 | - ->set('object_type', $values['object_type']) |
|
677 | - ->set('object_id', $values['object_id']) |
|
676 | + ->set('object_type', $values['object_type']) |
|
677 | + ->set('object_id', $values['object_id']) |
|
678 | 678 | ->where($qb->expr()->eq('user_id', $qb->createParameter('user_id'))) |
679 | 679 | ->andWhere($qb->expr()->eq('object_type', $qb->createParameter('object_type'))) |
680 | 680 | ->andWhere($qb->expr()->eq('object_id', $qb->createParameter('object_id'))) |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | |
718 | 718 | $data = $resultStatement->fetch(); |
719 | 719 | $resultStatement->closeCursor(); |
720 | - if(!$data || is_null($data['marker_datetime'])) { |
|
720 | + if (!$data || is_null($data['marker_datetime'])) { |
|
721 | 721 | return null; |
722 | 722 | } |
723 | 723 | |
@@ -774,10 +774,10 @@ discard block |
||
774 | 774 | * \OutOfBoundsException has to thrown. |
775 | 775 | */ |
776 | 776 | public function registerDisplayNameResolver($type, \Closure $closure) { |
777 | - if(!is_string($type)) { |
|
777 | + if (!is_string($type)) { |
|
778 | 778 | throw new \InvalidArgumentException('String expected.'); |
779 | 779 | } |
780 | - if(isset($this->displayNameResolvers[$type])) { |
|
780 | + if (isset($this->displayNameResolvers[$type])) { |
|
781 | 781 | throw new \OutOfBoundsException('Displayname resolver for this type already registered'); |
782 | 782 | } |
783 | 783 | $this->displayNameResolvers[$type] = $closure; |
@@ -797,13 +797,13 @@ discard block |
||
797 | 797 | * provided ID is unknown. It must be ensured that a string is returned. |
798 | 798 | */ |
799 | 799 | public function resolveDisplayName($type, $id) { |
800 | - if(!is_string($type)) { |
|
800 | + if (!is_string($type)) { |
|
801 | 801 | throw new \InvalidArgumentException('String expected.'); |
802 | 802 | } |
803 | - if(!isset($this->displayNameResolvers[$type])) { |
|
803 | + if (!isset($this->displayNameResolvers[$type])) { |
|
804 | 804 | throw new \OutOfBoundsException('No Displayname resolver for this type registered'); |
805 | 805 | } |
806 | - return (string)$this->displayNameResolvers[$type]($id); |
|
806 | + return (string) $this->displayNameResolvers[$type]($id); |
|
807 | 807 | } |
808 | 808 | |
809 | 809 | /** |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | * @return \OCP\Comments\ICommentsEventHandler[] |
813 | 813 | */ |
814 | 814 | private function getEventHandlers() { |
815 | - if(!empty($this->eventHandlers)) { |
|
815 | + if (!empty($this->eventHandlers)) { |
|
816 | 816 | return $this->eventHandlers; |
817 | 817 | } |
818 | 818 |
@@ -146,7 +146,7 @@ |
||
146 | 146 | throw new \InvalidArgumentException('The given notifier information is invalid'); |
147 | 147 | } |
148 | 148 | if (isset($this->notifiersInfo[$notifier['id']])) { |
149 | - throw new \InvalidArgumentException('The given notifier ID ' . $notifier['id'] . ' is already in use'); |
|
149 | + throw new \InvalidArgumentException('The given notifier ID '.$notifier['id'].' is already in use'); |
|
150 | 150 | } |
151 | 151 | $this->notifiersInfo[$notifier['id']] = $notifier['name']; |
152 | 152 | } |
@@ -48,7 +48,7 @@ |
||
48 | 48 | * @return bool |
49 | 49 | */ |
50 | 50 | public function accept() { |
51 | - if($this->isDir()) { |
|
51 | + if ($this->isDir()) { |
|
52 | 52 | return true; |
53 | 53 | } |
54 | 54 |
@@ -30,25 +30,25 @@ |
||
30 | 30 | parent::__construct($iterator); |
31 | 31 | |
32 | 32 | $appFolders = \OC::$APPSROOTS; |
33 | - foreach($appFolders as $key => $appFolder) { |
|
33 | + foreach ($appFolders as $key => $appFolder) { |
|
34 | 34 | $appFolders[$key] = rtrim($appFolder['path'], '/'); |
35 | 35 | } |
36 | 36 | |
37 | 37 | $excludedFolders = [ |
38 | - rtrim($root . '/data', '/'), |
|
39 | - rtrim($root . '/themes', '/'), |
|
40 | - rtrim($root . '/config', '/'), |
|
41 | - rtrim($root . '/apps', '/'), |
|
42 | - rtrim($root . '/assets', '/'), |
|
43 | - rtrim($root . '/lost+found', '/'), |
|
38 | + rtrim($root.'/data', '/'), |
|
39 | + rtrim($root.'/themes', '/'), |
|
40 | + rtrim($root.'/config', '/'), |
|
41 | + rtrim($root.'/apps', '/'), |
|
42 | + rtrim($root.'/assets', '/'), |
|
43 | + rtrim($root.'/lost+found', '/'), |
|
44 | 44 | // Ignore folders generated by updater since the updater is replaced |
45 | 45 | // after the integrity check is run. |
46 | 46 | // See https://github.com/owncloud/updater/issues/318#issuecomment-212497846 |
47 | - rtrim($root . '/updater', '/'), |
|
48 | - rtrim($root . '/_oc_upgrade', '/'), |
|
47 | + rtrim($root.'/updater', '/'), |
|
48 | + rtrim($root.'/_oc_upgrade', '/'), |
|
49 | 49 | ]; |
50 | 50 | $customDataDir = \OC::$server->getConfig()->getSystemValue('datadirectory', ''); |
51 | - if($customDataDir !== '') { |
|
51 | + if ($customDataDir !== '') { |
|
52 | 52 | $excludedFolders[] = rtrim($customDataDir, '/'); |
53 | 53 | } |
54 | 54 |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function file_put_contents($filename, $data) { |
61 | 61 | $bytesWritten = @file_put_contents($filename, $data); |
62 | - if ($bytesWritten === false || $bytesWritten !== strlen($data)){ |
|
63 | - throw new \Exception('Failed to write into ' . $filename); |
|
62 | + if ($bytesWritten === false || $bytesWritten !== strlen($data)) { |
|
63 | + throw new \Exception('Failed to write into '.$filename); |
|
64 | 64 | } |
65 | 65 | return $bytesWritten; |
66 | 66 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function assertDirectoryExists($path) { |
81 | 81 | if (!is_dir($path)) { |
82 | - throw new \Exception('Directory ' . $path . ' does not exist.'); |
|
82 | + throw new \Exception('Directory '.$path.' does not exist.'); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | */ |
40 | 40 | public function getAppPath($appId) { |
41 | 41 | $path = \OC_App::getAppPath($appId); |
42 | - if($path === false) { |
|
42 | + if ($path === false) { |
|
43 | 43 | |
44 | 44 | throw new \Exception('App not found'); |
45 | 45 | } |