@@ -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 | |
@@ -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 | } |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | 63 | public function __toString() { |
| 64 | - return __CLASS__ . ": [{$this->code}]: {$this->message} ({$this->hint})\n"; |
|
| 64 | + return __CLASS__.": [{$this->code}]: {$this->message} ({$this->hint})\n"; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | use Symfony\Component\EventDispatcher\EventDispatcher; |
| 59 | 59 | use Symfony\Component\EventDispatcher\GenericEvent; |
| 60 | 60 | |
| 61 | -class Repair implements IOutput{ |
|
| 61 | +class Repair implements IOutput { |
|
| 62 | 62 | /* @var IRepairStep[] */ |
| 63 | 63 | private $repairSteps; |
| 64 | 64 | /** @var EventDispatcher */ |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | /** |
| 81 | 81 | * @inheritdoc |
| 82 | 82 | */ |
| 83 | - public function get ($size = 64) { |
|
| 83 | + public function get($size = 64) { |
|
| 84 | 84 | try { |
| 85 | 85 | $file = $this->getFile($size); |
| 86 | 86 | } catch (NotFoundException $e) { |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | * @throws NotSquareException if the image is not square |
| 111 | 111 | * @return void |
| 112 | 112 | */ |
| 113 | - public function set ($data) { |
|
| 113 | + public function set($data) { |
|
| 114 | 114 | |
| 115 | - if($data instanceOf IImage) { |
|
| 115 | + if ($data instanceOf IImage) { |
|
| 116 | 116 | $img = $data; |
| 117 | 117 | $data = $img->data(); |
| 118 | 118 | } else { |
@@ -143,12 +143,12 @@ discard block |
||
| 143 | 143 | * remove the users avatar |
| 144 | 144 | * @return void |
| 145 | 145 | */ |
| 146 | - public function remove () { |
|
| 146 | + public function remove() { |
|
| 147 | 147 | $regex = '/^avatar\.([0-9]+\.)?(jpg|png)$/'; |
| 148 | 148 | $avatars = $this->folder->getDirectoryListing(); |
| 149 | 149 | |
| 150 | 150 | $this->config->setUserValue($this->user->getUID(), 'avatar', 'version', |
| 151 | - (int)$this->config->getUserValue($this->user->getUID(), 'avatar', 'version', 0) + 1); |
|
| 151 | + (int) $this->config->getUserValue($this->user->getUID(), 'avatar', 'version', 0) + 1); |
|
| 152 | 152 | |
| 153 | 153 | foreach ($avatars as $avatar) { |
| 154 | 154 | if (preg_match($regex, $avatar->getName())) { |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | $ext = $this->getExtension(); |
| 166 | 166 | |
| 167 | 167 | if ($size === -1) { |
| 168 | - $path = 'avatar.' . $ext; |
|
| 168 | + $path = 'avatar.'.$ext; |
|
| 169 | 169 | } else { |
| 170 | - $path = 'avatar.' . $size . '.' . $ext; |
|
| 170 | + $path = 'avatar.'.$size.'.'.$ext; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | try { |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | $avatar = new OC_Image(); |
| 181 | 181 | /** @var ISimpleFile $file */ |
| 182 | - $file = $this->folder->getFile('avatar.' . $ext); |
|
| 182 | + $file = $this->folder->getFile('avatar.'.$ext); |
|
| 183 | 183 | $avatar->loadFromData($file->getContent()); |
| 184 | 184 | if ($size !== -1) { |
| 185 | 185 | $avatar->resize($size); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $file = $this->folder->newFile($path); |
| 189 | 189 | $file->putContent($avatar->data()); |
| 190 | 190 | } catch (NotPermittedException $e) { |
| 191 | - $this->logger->error('Failed to save avatar for ' . $this->user->getUID()); |
|
| 191 | + $this->logger->error('Failed to save avatar for '.$this->user->getUID()); |
|
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |