| @@ -92,13 +92,13 @@ discard block | ||
| 92 | 92 | } | 
| 93 | 93 | |
| 94 | 94 | return [ | 
| 95 | -            'created' => function ($role) use ($attributes) { | |
| 95 | +            'created' => function($role) use ($attributes) { | |
| 96 | 96 |                  return $attributes['created']->toDateTime()->format('c'); | 
| 97 | 97 | }, | 
| 98 | -            'changed' => function ($role) use ($attributes) { | |
| 98 | +            'changed' => function($role) use ($attributes) { | |
| 99 | 99 |                  return $attributes['changed']->toDateTime()->format('c'); | 
| 100 | 100 | }, | 
| 101 | -            'deleted' => function ($role) use ($attributes) { | |
| 101 | +            'deleted' => function($role) use ($attributes) { | |
| 102 | 102 |                  if (false === $attributes['deleted']) { | 
| 103 | 103 | return null; | 
| 104 | 104 | } | 
| @@ -145,7 +145,7 @@ discard block | ||
| 145 | 145 | 'name' => (string) $attributes['username'], | 
| 146 | 146 | 'admin' => (bool) $attributes['admin'], | 
| 147 | 147 | 'namespace' => isset($attributes['namespace']) ? (string) $attributes['namespace'] : null, | 
| 148 | -            'mail' => function ($role) use ($attributes, $user) { | |
| 148 | +            'mail' => function($role) use ($attributes, $user) { | |
| 149 | 149 |                  if (!isset($attributes['mail'])) { | 
| 150 | 150 | return null; | 
| 151 | 151 | } | 
| @@ -157,7 +157,7 @@ discard block | ||
| 157 | 157 | return null; | 
| 158 | 158 | }, | 
| 159 | 159 | 'locale' => isset($attributes['locale']) ? (string) $attributes['locale'] : null, | 
| 160 | -            'quota' => function ($role) use ($attributes, $user) { | |
| 160 | +            'quota' => function($role) use ($attributes, $user) { | |
| 161 | 161 |                  if ($attributes['_id'] == $user->getId() || $user->isAdmin()) { | 
| 162 | 162 | return $role->getQuotaUsage(); | 
| 163 | 163 | } | 
| @@ -127,20 +127,20 @@ discard block | ||
| 127 | 127 | 'mime' => (string) $attributes['mime'], | 
| 128 | 128 | 'readonly' => (bool) $attributes['readonly'], | 
| 129 | 129 | 'directory' => $node instanceof Collection, | 
| 130 | -            'meta' => function ($node) { | |
| 130 | +            'meta' => function($node) { | |
| 131 | 131 | return (object) $node->getMetaAttributes(); | 
| 132 | 132 | }, | 
| 133 | -            'size' => function ($node) { | |
| 133 | +            'size' => function($node) { | |
| 134 | 134 | return $node->getSize(); | 
| 135 | 135 | }, | 
| 136 | -            'path' => function ($node) { | |
| 136 | +            'path' => function($node) { | |
| 137 | 137 |                  try { | 
| 138 | 138 | return $node->getPath(); | 
| 139 | 139 |                  } catch (\Exception $e) { | 
| 140 | 140 | return null; | 
| 141 | 141 | } | 
| 142 | 142 | }, | 
| 143 | -            'parent' => function ($node) { | |
| 143 | +            'parent' => function($node) { | |
| 144 | 144 | $id = $node->getAttributes()['parent']; | 
| 145 | 145 | |
| 146 | 146 |                  if (null === $id) { | 
| @@ -149,10 +149,10 @@ discard block | ||
| 149 | 149 | |
| 150 | 150 | return (string) $id; | 
| 151 | 151 | }, | 
| 152 | -            'access' => function ($node) use ($acl) { | |
| 152 | +            'access' => function($node) use ($acl) { | |
| 153 | 153 | return $acl->getAclPrivilege($node); | 
| 154 | 154 | }, | 
| 155 | -            'share' => function ($node) { | |
| 155 | +            'share' => function($node) { | |
| 156 | 156 |                  if (!$node->isShared() && !$node->isSpecial()) { | 
| 157 | 157 | return false; | 
| 158 | 158 | } | 
| @@ -163,7 +163,7 @@ discard block | ||
| 163 | 163 | return false; | 
| 164 | 164 | } | 
| 165 | 165 | }, | 
| 166 | -            'shareowner' => function ($node) use ($server, $fs) { | |
| 166 | +            'shareowner' => function($node) use ($server, $fs) { | |
| 167 | 167 |                  if (!$node->isSpecial()) { | 
| 168 | 168 | return null; | 
| 169 | 169 | } | 
| @@ -206,20 +206,20 @@ discard block | ||
| 206 | 206 | protected function getTimeAttributes(NodeInterface $node, array $attributes): array | 
| 207 | 207 |      { | 
| 208 | 208 | return [ | 
| 209 | -            'created' => function ($node) use ($attributes) { | |
| 209 | +            'created' => function($node) use ($attributes) { | |
| 210 | 210 | return $this->dateTimeToUnix($attributes['created']); | 
| 211 | 211 | }, | 
| 212 | -            'changed' => function ($node) use ($attributes) { | |
| 212 | +            'changed' => function($node) use ($attributes) { | |
| 213 | 213 | return $this->dateTimeToUnix($attributes['changed']); | 
| 214 | 214 | }, | 
| 215 | -            'deleted' => function ($node) use ($attributes) { | |
| 215 | +            'deleted' => function($node) use ($attributes) { | |
| 216 | 216 |                  if (false === $attributes['deleted']) { | 
| 217 | 217 | return false; | 
| 218 | 218 | } | 
| 219 | 219 | |
| 220 | 220 | return $this->dateTimeToUnix($attributes['deleted']); | 
| 221 | 221 | }, | 
| 222 | -            'destroy' => function ($node) use ($attributes) { | |
| 222 | +            'destroy' => function($node) use ($attributes) { | |
| 223 | 223 |                  if (null === $attributes['destroy']) { | 
| 224 | 224 | return null; | 
| 225 | 225 | } | 
| @@ -370,7 +370,7 @@ discard block | ||
| 370 | 370 | } | 
| 371 | 371 | |
| 372 | 372 |          $attributes = compact('password', 'soft_quota', 'hard_quota', 'avatar', 'mail', 'admin', 'namespace', 'locale', 'optional'); | 
| 373 | -        $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); | |
| 373 | +        $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); | |
| 374 | 374 | |
| 375 | 375 |          if (isset($attributes['avatar'])) { | 
| 376 | 376 | $attributes['avatar'] = new Binary(base64_decode($attributes['avatar']), Binary::TYPE_GENERIC); | 
| @@ -415,7 +415,7 @@ discard block | ||
| 415 | 415 | public function patch(?string $id = null, ?string $uname = null, ?string $username = null, ?string $password = null, ?int $soft_quota = null, ?int $hard_quota = null, ?string $avatar = null, ?string $mail = null, ?bool $admin = null, ?string $namespace = null, ?string $locale = null, ?array $optional = null): Response | 
| 416 | 416 |      { | 
| 417 | 417 |          $attributes = compact('username', 'password', 'soft_quota', 'hard_quota', 'avatar', 'mail', 'admin', 'namespace', 'locale', 'optional'); | 
| 418 | -        $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); | |
| 418 | +        $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); | |
| 419 | 419 | |
| 420 | 420 |          if (isset($attributes['avatar'])) { | 
| 421 | 421 | $attributes['avatar'] = new Binary(base64_decode($attributes['avatar']), Binary::TYPE_GENERIC); |