@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Balloon |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param Iterable $config |
32 | 32 | * @return PluginInterface |
33 | 33 | */ |
34 | - public function setOptions(?Iterable $config): PluginInterface |
|
34 | + public function setOptions(? Iterable $config) : PluginInterface |
|
35 | 35 | { |
36 | 36 | if ($config === null) { |
37 | 37 | return $this; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function cli(Filesystem $fs): void |
59 | 59 | { |
60 | - $lt = time() - $this->max_age; |
|
60 | + $lt = time() - $this->max_age; |
|
61 | 61 | |
62 | 62 | $result = $fs->findNodesWithCustomFilter(['deleted' => ['$lt' => new UTCDateTime($lt)]]); |
63 | 63 | $this->logger->info('found ['.count($result).'] nodes for cleanup, force remove them from trash', [ |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Balloon |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param Iterable $config |
59 | 59 | * @return PluginInterface |
60 | 60 | */ |
61 | - public function setOptions(?Iterable $config): PluginInterface |
|
61 | + public function setOptions(? Iterable $config) : PluginInterface |
|
62 | 62 | { |
63 | 63 | if ($config === null) { |
64 | 64 | return $this; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | 'category' => get_class($this), |
101 | 101 | ]); |
102 | 102 | |
103 | - $result = $this->_findShare($share); |
|
103 | + $result = $this->_findShare($share); |
|
104 | 104 | $shares = array_merge_recursive($shares, $result); |
105 | 105 | } |
106 | 106 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Balloon |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param Iterable $config |
33 | 33 | * @return PluginInterface |
34 | 34 | */ |
35 | - public function setOptions(?Iterable $config): PluginInterface |
|
35 | + public function setOptions(? Iterable $config) : PluginInterface |
|
36 | 36 | { |
37 | 37 | if ($config === null) { |
38 | 38 | return $this; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param bool $autocreate |
58 | 58 | * @return void |
59 | 59 | */ |
60 | - public function preInstanceUser(User $user, string &$username, ?array &$attributes, bool $autocreate): void |
|
60 | + public function preInstanceUser(User $user, string&$username, ? array &$attributes, bool $autocreate) : void |
|
61 | 61 | { |
62 | 62 | if ($autocreate === false || $attributes !== null) { |
63 | 63 | return; |
@@ -84,19 +84,19 @@ discard block |
||
84 | 84 | |
85 | 85 | switch ($value['type']) { |
86 | 86 | case 'string': |
87 | - $attributes[$attr] = (string)$value['value']; |
|
87 | + $attributes[$attr] = (string)$value['value']; |
|
88 | 88 | break; |
89 | 89 | |
90 | 90 | case 'int': |
91 | - $attributes[$attr] = (int)$value['value']; |
|
91 | + $attributes[$attr] = (int)$value['value']; |
|
92 | 92 | break; |
93 | 93 | |
94 | 94 | case 'bool': |
95 | - $attributes[$attr] = (bool)$value['value']; |
|
95 | + $attributes[$attr] = (bool)$value['value']; |
|
96 | 96 | break; |
97 | 97 | |
98 | 98 | case 'binary': |
99 | - $attributes[$attr] = new Binary($value['value']); |
|
99 | + $attributes[$attr] = new Binary($value['value']); |
|
100 | 100 | break; |
101 | 101 | |
102 | 102 | default: |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Balloon |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param Iterable $config |
53 | 53 | * @return PluginInterface |
54 | 54 | */ |
55 | - public function setOptions(?Iterable $config): PluginInterface |
|
55 | + public function setOptions(? Iterable $config) : PluginInterface |
|
56 | 56 | { |
57 | 57 | if ($config === null) { |
58 | 58 | return $this; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param bool $recursion_first |
108 | 108 | * @return void |
109 | 109 | */ |
110 | - public function postSaveNodeAttributes(INode $node, array $attributes, array $remove, ?string $recursion, bool $recursion_first): void |
|
110 | + public function postSaveNodeAttributes(INode $node, array $attributes, array $remove, ? string $recursion, bool $recursion_first) : void |
|
111 | 111 | { |
112 | 112 | if (!($node instanceof Collection)) { |
113 | 113 | return; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $acl = $node->getShare(); |
124 | 124 | $resource = new Resource($fs->getUser(), $this->logger, $fs); |
125 | 125 | if ($node->isShared() && is_array($acl) && (isset($raw['acl']) && $raw['acl'] !== $node->getAcl() || !isset($raw['acl']))) { |
126 | - $receiver=[]; |
|
126 | + $receiver = []; |
|
127 | 127 | foreach ($acl as $rule) { |
128 | 128 | if ($rule['type'] == 'user') { |
129 | 129 | $user = new User($rule['name'], $this->logger, $fs, true, false); |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | if (!empty($receiver)) { |
145 | - $body = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function ($match) use ($node) { |
|
145 | + $body = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function($match) use ($node) { |
|
146 | 146 | return $node->getAttribute($match[2]); |
147 | 147 | }, $this->notifications['new_share']['body']); |
148 | - $subject = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function ($match) use ($node) { |
|
148 | + $subject = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function($match) use ($node) { |
|
149 | 149 | return $node->getAttribute($match[2]); |
150 | 150 | }, $this->notifications['new_share']['subject']); |
151 | 151 | |
152 | - $mail = new Message(); |
|
152 | + $mail = new Message(); |
|
153 | 153 | $mail->setBody($body); |
154 | 154 | $mail->setFrom($this->notifications['new_share']['sender']['address'], |
155 | 155 | $this->notifications['new_share']['sender']['name']); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param User $user |
172 | 172 | * @return string |
173 | 173 | */ |
174 | - protected function checkNotify(INode $node, User $user): ?string |
|
174 | + protected function checkNotify(INode $node, User $user): ? string |
|
175 | 175 | { |
176 | 176 | if ($user->hasShare($node)) { |
177 | 177 | $this->logger->debug('skip mail notifcation for share ['.$node->getId().'] user ['.$user->getId().'] already owns it', [ |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Balloon |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param string $env |
32 | 32 | * @return void |
33 | 33 | */ |
34 | - public function __construct(string $config, string $env='production') |
|
34 | + public function __construct(string $config, string $env = 'production') |
|
35 | 35 | { |
36 | 36 | $config = simplexml_load_file($config); |
37 | 37 | if ($this->store === false) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param bool $replace |
87 | 87 | * @return bool |
88 | 88 | */ |
89 | - protected function appendSimplexml(SimpleXMLElement &$simplexml_to, SimpleXMLElement &$simplexml_from, bool $replace=true): bool |
|
89 | + protected function appendSimplexml(SimpleXMLElement&$simplexml_to, SimpleXMLElement&$simplexml_from, bool $replace = true): bool |
|
90 | 90 | { |
91 | 91 | if (count($simplexml_from->children()) === 0) { |
92 | 92 | if ($replace === true && count($simplexml_to->children()) === 0) { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | foreach ($simplexml_from->attributes() as $attr_key => $attr_value) { |
99 | 99 | if (!isset($attrs[$attr_key])) { |
100 | 100 | $simplexml_to->addAttribute($attr_key, (string)$attr_value); |
101 | - } elseif ($replace===true) { |
|
101 | + } elseif ($replace === true) { |
|
102 | 102 | $simplexml_to->attributes()->{$attr_key} = (string)$attr_value; |
103 | 103 | } |
104 | 104 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | foreach ($simplexml_child->attributes() as $attr_key => $attr_value) { |
119 | 119 | if (!isset($attrs[$attr_key])) { |
120 | 120 | $simplexml_to->{$simplexml_child->getName()}->addAttribute($attr_key, (string)$attr_value); |
121 | - } elseif ($replace===true) { |
|
121 | + } elseif ($replace === true) { |
|
122 | 122 | $simplexml_to->{$simplexml_child->getName()}->attributes()->{$attr_key} = (string)$attr_value; |
123 | 123 | } |
124 | 124 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @param SimpleXMLElement $xml |
191 | 191 | * @return Config |
192 | 192 | */ |
193 | - public function map($xml=null): Config |
|
193 | + public function map($xml = null): Config |
|
194 | 194 | { |
195 | 195 | if ($xml === null) { |
196 | 196 | $xml = $this->store; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | foreach ($xml->getNamespaces() + array(null) as $prefix => $namespace) { |
201 | 201 | foreach ($xml->attributes($namespace) as $key => $value) { |
202 | 202 | if (is_string($prefix)) { |
203 | - $key = $prefix . '.' . $key; |
|
203 | + $key = $prefix.'.'.$key; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | if ($key === 'inherits') { |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | if (!isset($arr[$name])) { |
218 | 218 | $config[$name] = $value; |
219 | 219 | } else { |
220 | - foreach ((array) $value as $k => $v) { |
|
220 | + foreach ((array)$value as $k => $v) { |
|
221 | 221 | if (is_numeric($k)) { |
222 | 222 | $config[$name][] = $v; |
223 | 223 | } else { |
224 | 224 | $config[$name][$k] = array_merge( |
225 | - (array) $config[$name][$k], |
|
226 | - (array) $v |
|
225 | + (array)$config[$name][$k], |
|
226 | + (array)$v |
|
227 | 227 | ); |
228 | 228 | } |
229 | 229 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $config[$name] = new Config(); |
233 | 233 | } |
234 | 234 | } |
235 | - if ($content = trim((string) $xml)) { |
|
235 | + if ($content = trim((string)$xml)) { |
|
236 | 236 | $config[] = $content; |
237 | 237 | } |
238 | 238 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Balloon |
@@ -58,5 +58,5 @@ discard block |
||
58 | 58 | * @param mixed $config |
59 | 59 | * @return Config |
60 | 60 | */ |
61 | - public function map($native=null): Config; |
|
61 | + public function map($native = null): Config; |
|
62 | 62 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Balloon |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @var bool |
87 | 87 | */ |
88 | - protected $tls=false; |
|
88 | + protected $tls = false; |
|
89 | 89 | |
90 | 90 | |
91 | 91 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param Logger $logger |
104 | 104 | * @return resource |
105 | 105 | */ |
106 | - public function __construct(?Iterable $config, Logger $logger) |
|
106 | + public function __construct(? Iterable $config, Logger $logger) |
|
107 | 107 | { |
108 | 108 | $this->setOptions($config); |
109 | 109 | $this->logger = $logger; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @param Iterable $config |
152 | 152 | * @return Ldap |
153 | 153 | */ |
154 | - public function setOptions(?Iterable $config): Ldap |
|
154 | + public function setOptions(? Iterable $config) : Ldap |
|
155 | 155 | { |
156 | 156 | if ($config === null) { |
157 | 157 | return $this; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Balloon |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | * @param Iterable $config |
33 | 33 | * @return void |
34 | 34 | */ |
35 | - public function __construct(Logger $logger, ?Iterable $config) |
|
35 | + public function __construct(Logger $logger, ? Iterable $config) |
|
36 | 36 | { |
37 | - $this->logger = $logger; |
|
37 | + $this->logger = $logger; |
|
38 | 38 | $this->setOptions($config); |
39 | 39 | } |
40 | 40 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Balloon |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | public function start() |
55 | 55 | { |
56 | 56 | if (isset($_GET['t']) && !empty($_GET['t'])) { |
57 | - $token = $_GET['t']; |
|
57 | + $token = $_GET['t']; |
|
58 | 58 | if (isset($_GET['download'])) { |
59 | 59 | $download = (bool)$_GET['download']; |
60 | 60 | } else { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | if ($download === true || preg_match('#html#', $mime)) { |
94 | - header('Content-Disposition: attachment; filename*=UTF-8\'\'' .rawurlencode($name)); |
|
94 | + header('Content-Disposition: attachment; filename*=UTF-8\'\''.rawurlencode($name)); |
|
95 | 95 | header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); |
96 | 96 | header('Content-Type: application/octet-stream'); |
97 | 97 | header('Content-Length: '.$node->getSize()); |