@@ -34,7 +34,7 @@ |
||
34 | 34 | ->prependRoute(new Route('/api/v2/files/convert(/|\z)', Convert::class)) |
35 | 35 | ->prependRoute(new Route('/api/v2/files/{id:#([0-9a-z]{24})#}/convert(/|\z)', Convert::class)); |
36 | 36 | |
37 | - $node_decorator->addDecorator('master', function ($node) use ($convert_decorator, $converter) { |
|
37 | + $node_decorator->addDecorator('master', function($node) use ($convert_decorator, $converter) { |
|
38 | 38 | $master = $node->getAppAttribute('Balloon\\App\\Convert', 'master'); |
39 | 39 | if (null === $master) { |
40 | 40 | return null; |
@@ -101,14 +101,14 @@ |
||
101 | 101 | return [ |
102 | 102 | 'id' => (string) $slave['_id'], |
103 | 103 | 'format' => (string) $slave['format'], |
104 | - 'master' => function ($slave) use ($fs, $node_decorator) { |
|
104 | + 'master' => function($slave) use ($fs, $node_decorator) { |
|
105 | 105 | try { |
106 | 106 | return $node_decorator->decorate($fs->findNodeById($slave['master']), ['_links', 'id', 'name']); |
107 | 107 | } catch (\Exception $e) { |
108 | 108 | return null; |
109 | 109 | } |
110 | 110 | }, |
111 | - 'slave' => function ($slave) use ($fs, $node_decorator) { |
|
111 | + 'slave' => function($slave) use ($fs, $node_decorator) { |
|
112 | 112 | if (!isset($slave['slave'])) { |
113 | 113 | return null; |
114 | 114 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct(AttributeDecorator $decorator) |
26 | 26 | { |
27 | - $decorator->addDecorator('malware_quarantine', function ($node) { |
|
27 | + $decorator->addDecorator('malware_quarantine', function($node) { |
|
28 | 28 | if ($node instanceof File) { |
29 | 29 | $quarantine = $node->getAppAttribute('Balloon\\App\\ClamAv', 'quarantine'); |
30 | 30 | if (is_bool($quarantine)) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | }); |
35 | - $decorator->addDecorator('malware_scantime', function ($node) { |
|
35 | + $decorator->addDecorator('malware_scantime', function($node) { |
|
36 | 36 | if ($node instanceof File) { |
37 | 37 | $ts = $node->getAppAttribute('Balloon\\App\\ClamAv', 'scantime'); |
38 | 38 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | }); |
44 | - $decorator->addDecorator('malware_reason', function ($node) { |
|
44 | + $decorator->addDecorator('malware_reason', function($node) { |
|
45 | 45 | if ($node instanceof File) { |
46 | 46 | return $node->getAppAttribute('Balloon\\App\\ClamAv', 'reason'); |
47 | 47 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | } |
271 | 271 | |
272 | 272 | $attributes = compact('namespace', 'optional'); |
273 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
273 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
274 | 274 | |
275 | 275 | $id = $this->server->addGroup($name, $member, $attributes); |
276 | 276 | $result = $this->decorator->decorate($this->server->getGroupById($id)); |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | public function patch(string $id, ?array $member = null, ?string $namespace = null, ?array $optional = null): Response |
310 | 310 | { |
311 | 311 | $attributes = compact('namespace', 'optional', 'name', 'member'); |
312 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
312 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
313 | 313 | |
314 | 314 | $group = $this->_getGroup($id, true); |
315 | 315 | $group->setAttributes($attributes); |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | return [ |
108 | - 'created' => function ($role, $requested) use ($attributes) { |
|
108 | + 'created' => function($role, $requested) use ($attributes) { |
|
109 | 109 | return $attributes['created']->toDateTime()->format('c'); |
110 | 110 | }, |
111 | - 'changed' => function ($role, $requested) use ($attributes) { |
|
111 | + 'changed' => function($role, $requested) use ($attributes) { |
|
112 | 112 | return $attributes['changed']->toDateTime()->format('c'); |
113 | 113 | }, |
114 | - 'deleted' => function ($role, $requested) use ($attributes) { |
|
114 | + 'deleted' => function($role, $requested) use ($attributes) { |
|
115 | 115 | if (false === $attributes['deleted']) { |
116 | 116 | return null; |
117 | 117 | } |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | 'name' => (string) $attributes['username'], |
165 | 165 | 'namespace' => (string) $attributes['namespace'], |
166 | 166 | 'mail' => (string) $attributes['mail'], |
167 | - 'avatar' => function ($role, $requested) use ($attributes) { |
|
167 | + 'avatar' => function($role, $requested) use ($attributes) { |
|
168 | 168 | if ($attributes['avatar'] instanceof Binary) { |
169 | 169 | return base64_encode($attributes['avatar']->getData()); |
170 | 170 | } |
171 | 171 | |
172 | 172 | return null; |
173 | 173 | }, |
174 | - 'soft_quota' => function ($role, $requested) use ($attributes, $user) { |
|
174 | + 'soft_quota' => function($role, $requested) use ($attributes, $user) { |
|
175 | 175 | if ($user === null) { |
176 | 176 | return null; |
177 | 177 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | return null; |
184 | 184 | }, |
185 | - 'hard_quota' => function ($role, $requested) use ($attributes, $user) { |
|
185 | + 'hard_quota' => function($role, $requested) use ($attributes, $user) { |
|
186 | 186 | if ($user === null) { |
187 | 187 | return null; |
188 | 188 | } |
@@ -73,7 +73,7 @@ |
||
73 | 73 | * Add decorator. |
74 | 74 | * |
75 | 75 | * |
76 | - * @return AttributeDecorator |
|
76 | + * @return RoleDecorator |
|
77 | 77 | */ |
78 | 78 | public function addDecorator(string $attribute, Closure $decorator): self |
79 | 79 | { |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @param string $class Force set node type |
211 | 211 | * @param bool $multiple Allow $id to be an array |
212 | 212 | * @param bool $allow_root Allow instance of root collection |
213 | - * @param bool $deleted How to handle deleted node |
|
213 | + * @param integer $deleted How to handle deleted node |
|
214 | 214 | */ |
215 | 215 | protected function _getNode( |
216 | 216 | ?string $id = null, |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @param string $id |
243 | 243 | * @param string $path |
244 | 244 | * @param string $class Force set node type |
245 | - * @param bool $deleted How to handle deleted node |
|
245 | + * @param integer $deleted How to handle deleted node |
|
246 | 246 | */ |
247 | 247 | protected function _getNodes( |
248 | 248 | $id = null, |
@@ -86,7 +86,7 @@ |
||
86 | 86 | * Add decorator. |
87 | 87 | * |
88 | 88 | * |
89 | - * @return AttributeDecorator |
|
89 | + * @return NodeDecorator |
|
90 | 90 | */ |
91 | 91 | public function addDecorator(string $attribute, Closure $decorator): self |
92 | 92 | { |
@@ -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 | $parent = $node->getParent(); |
145 | 145 | |
146 | 146 | if (null === $parent || $parent->isRoot()) { |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | |
150 | 150 | return (string) $parent->getId(); |
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 | } |
@@ -12,7 +12,6 @@ |
||
12 | 12 | namespace Balloon\App\Notification\Hook; |
13 | 13 | |
14 | 14 | use Balloon\App\Notification\Notifier; |
15 | -use Balloon\Async\Mail; |
|
16 | 15 | use Balloon\Filesystem\Node\Collection; |
17 | 16 | use Balloon\Filesystem\Node\NodeInterface; |
18 | 17 | use Balloon\Hook\AbstractHook; |
@@ -195,6 +195,7 @@ |
||
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Filesystem factory. |
198 | + * @param User $user |
|
198 | 199 | */ |
199 | 200 | public function getFilesystem(?User $user = null): Filesystem |
200 | 201 | { |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | |
534 | 534 | $this->identity = $user; |
535 | 535 | $user->updateIdentity($identity) |
536 | - ->updateShares(); |
|
536 | + ->updateShares(); |
|
537 | 537 | $this->hook->run('postServerIdentity', [$user]); |
538 | 538 | |
539 | 539 | return true; |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | public function getGroupByName(string $name): Group |
643 | 643 | { |
644 | 644 | $group = $this->db->group->findOne([ |
645 | - 'name' => $name, |
|
645 | + 'name' => $name, |
|
646 | 646 | ]); |
647 | 647 | |
648 | 648 | if (null === $group) { |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | } |
665 | 665 | |
666 | 666 | $group = $this->db->group->findOne([ |
667 | - '_id' => $id, |
|
667 | + '_id' => $id, |
|
668 | 668 | ]); |
669 | 669 | |
670 | 670 | if (null === $group) { |