@@ -68,7 +68,7 @@ |
||
68 | 68 | * Set options |
69 | 69 | * |
70 | 70 | * @param Iterable |
71 | - * @return Ldap |
|
71 | + * @return Db |
|
72 | 72 | */ |
73 | 73 | public function setOptions(?Iterable $config): Db |
74 | 74 | { |
@@ -12,7 +12,6 @@ |
||
12 | 12 | namespace Balloon\Auth\Adapter\Basic; |
13 | 13 | |
14 | 14 | use \Psr\Log\LoggerInterface as Logger; |
15 | -use Balloon\Config; |
|
16 | 15 | use Balloon\Auth\Adapter\AdapterInterface; |
17 | 16 | use \MongoDB\Database; |
18 | 17 |
@@ -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 |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * @param Logger $logger |
58 | 58 | * @return void |
59 | 59 | */ |
60 | - public function __construct(?Iterable $config, Logger $logger) |
|
60 | + public function __construct(? Iterable $config, Logger $logger) |
|
61 | 61 | { |
62 | - $this->logger = $logger; |
|
62 | + $this->logger = $logger; |
|
63 | 63 | $this->setOptions($config); |
64 | 64 | } |
65 | 65 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param Iterable |
71 | 71 | * @return Ldap |
72 | 72 | */ |
73 | - public function setOptions(?Iterable $config): Db |
|
73 | + public function setOptions(? Iterable $config) : Db |
|
74 | 74 | { |
75 | 75 | if ($config === null) { |
76 | 76 | return $this; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | return false; |
198 | 198 | } |
199 | 199 | |
200 | - $this->identity = $username; |
|
200 | + $this->identity = $username; |
|
201 | 201 | return true; |
202 | 202 | } |
203 | 203 |
@@ -11,9 +11,7 @@ |
||
11 | 11 | |
12 | 12 | namespace Balloon\Auth\Adapter\Basic; |
13 | 13 | |
14 | -use Balloon\Auth\Exception; |
|
15 | 14 | use \Psr\Log\LoggerInterface as Logger; |
16 | -use Balloon\Config; |
|
17 | 15 | use Balloon\Ldap as LdapServer; |
18 | 16 | use Balloon\Auth\Adapter\AdapterInterface; |
19 | 17 |
@@ -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 |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param Logger $logger |
75 | 75 | * @return void |
76 | 76 | */ |
77 | - public function __construct(?Iterable $config, Logger $logger) |
|
77 | + public function __construct(? Iterable $config, Logger $logger) |
|
78 | 78 | { |
79 | 79 | $this->logger = $logger; |
80 | 80 | $this->setOptions($config); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param Iterable |
110 | 110 | * @return Ldap |
111 | 111 | */ |
112 | - public function setOptions(?Iterable $config): LdapServer |
|
112 | + public function setOptions(? Iterable $config) : LdapServer |
|
113 | 113 | { |
114 | 114 | if ($config === null) { |
115 | 115 | return $this; |
@@ -27,7 +27,7 @@ |
||
27 | 27 | /** |
28 | 28 | * Initialize |
29 | 29 | * |
30 | - * @param Iterable $config |
|
30 | + * @param Config $config |
|
31 | 31 | * @param Logger $logger |
32 | 32 | * @return void |
33 | 33 | */ |
@@ -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 Logger $logger |
32 | 32 | * @return void |
33 | 33 | */ |
34 | - public function __construct(?Iterable $config, Logger $logger) |
|
34 | + public function __construct(? Iterable $config, Logger $logger) |
|
35 | 35 | { |
36 | 36 | } |
37 | 37 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return int |
43 | 43 | */ |
44 | - public function getAttributeSyncCache(): int |
|
44 | + public function getAttributeSyncCache() : int |
|
45 | 45 | { |
46 | 46 | return -1; |
47 | 47 | } |
@@ -14,7 +14,6 @@ |
||
14 | 14 | use Balloon\Auth\Exception; |
15 | 15 | use Balloon\Auth\Adapter\Basic\Ldap; |
16 | 16 | use Balloon\Ldap as LdapServer; |
17 | -use Balloon\Config; |
|
18 | 17 | |
19 | 18 | class Preauth extends Ldap implements AdapterInterface |
20 | 19 | { |
@@ -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 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param Iterable $config |
41 | 41 | * @return LdapServer |
42 | 42 | */ |
43 | - public function setOptions(?Iterable $config): LdapServer |
|
43 | + public function setOptions(? Iterable $config) : LdapServer |
|
44 | 44 | { |
45 | 45 | if ($config === null) { |
46 | 46 | return $this; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function preauth(string $value): bool |
110 | 110 | { |
111 | - $parts = explode('|', $value); |
|
111 | + $parts = explode('|', $value); |
|
112 | 112 | |
113 | 113 | if (count($parts) !== 2) { |
114 | 114 | $this->logger->warning('invalid header x-preauth value, parts != 2', [ |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | 'category' => get_class($this) |
196 | 196 | ]); |
197 | 197 | |
198 | - $this->ldap_dn = $dn; |
|
198 | + $this->ldap_dn = $dn; |
|
199 | 199 | |
200 | 200 | return true; |
201 | 201 | } |
@@ -220,6 +220,6 @@ discard block |
||
220 | 220 | $ip_decimal = ip2long($ip); |
221 | 221 | $wildcard_decimal = pow(2, (32 - $netmask)) - 1; |
222 | 222 | $netmask_decimal = ~ $wildcard_decimal; |
223 | - return (($ip_decimal & $netmask_decimal) == ($range_decimal & $netmask_decimal)); |
|
223 | + return (($ip_decimal&$netmask_decimal) == ($range_decimal&$netmask_decimal)); |
|
224 | 224 | } |
225 | 225 | } |
@@ -93,7 +93,6 @@ |
||
93 | 93 | * Init bootstrap |
94 | 94 | * |
95 | 95 | * @param Composer $composer |
96 | - * @param Config $router |
|
97 | 96 | * @return void |
98 | 97 | */ |
99 | 98 | public function __construct(Composer $composer, Config $config) |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Balloon |
@@ -138,7 +138,7 @@ |
||
138 | 138 | /** |
139 | 139 | * Set error handler |
140 | 140 | * |
141 | - * @return Core |
|
141 | + * @return AbstractCore |
|
142 | 142 | */ |
143 | 143 | protected function setErrorHandler() |
144 | 144 | { |
@@ -11,7 +11,6 @@ discard block |
||
11 | 11 | |
12 | 12 | namespace Balloon\Bootstrap; |
13 | 13 | |
14 | -use Balloon\Http\Router; |
|
15 | 14 | use Balloon\Exception; |
16 | 15 | use Balloon\Config; |
17 | 16 | use Balloon\Logger; |
@@ -19,8 +18,6 @@ discard block |
||
19 | 18 | use Balloon\Queue; |
20 | 19 | use Balloon\Filesystem; |
21 | 20 | use \Composer\Autoload\ClassLoader as Composer; |
22 | -use Balloon\Http\Router\Route; |
|
23 | -use Balloon\Http\Response; |
|
24 | 21 | |
25 | 22 | abstract class AbstractCore extends AbstractBootstrap |
26 | 23 | { |
@@ -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 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @var Config |
47 | 47 | */ |
48 | - protected $option_log ; |
|
48 | + protected $option_log; |
|
49 | 49 | |
50 | 50 | |
51 | 51 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | protected function setErrorHandler() |
144 | 144 | { |
145 | - set_error_handler(function ($errno, $errstr, $errfile, $errline) { |
|
145 | + set_error_handler(function($errno, $errstr, $errfile, $errline) { |
|
146 | 146 | $msg = $errstr." in ".$errfile.":".$errline; |
147 | 147 | switch ($errno) { |
148 | 148 | case E_ERROR: |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * Get entire simplexml |
31 | 31 | * |
32 | - * @return mixed |
|
32 | + * @return \SimpleXMLElement |
|
33 | 33 | */ |
34 | 34 | public function getRaw(); |
35 | 35 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * Get from config |
39 | 39 | * |
40 | 40 | * @param string $name |
41 | - * @return mixed |
|
41 | + * @return \SimpleXMLElement |
|
42 | 42 | */ |
43 | 43 | public function __get(string $name); |
44 | 44 | |
@@ -55,7 +55,6 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * Get native config format as config instance |
57 | 57 | * |
58 | - * @param mixed $config |
|
59 | 58 | * @return Config |
60 | 59 | */ |
61 | 60 | public function map($native=null): Config; |
@@ -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 | } |
@@ -81,7 +81,7 @@ |
||
81 | 81 | /** |
82 | 82 | * Merge xml tree's |
83 | 83 | * |
84 | - * @param SimpleXMLElement $simmplexml_to |
|
84 | + * @param SimpleXMLElement $simplexml_to |
|
85 | 85 | * @param SimpleXMLElement $simplexml_from |
86 | 86 | * @param bool $replace |
87 | 87 | * @return bool |
@@ -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 |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | * |
432 | 432 | * @param array $id |
433 | 433 | * @param string $class Fore check node type |
434 | - * @param bool $deleted |
|
434 | + * @param integer $deleted |
|
435 | 435 | * @return Generator |
436 | 436 | */ |
437 | 437 | public function findNodes(array $id=[], ?string $class=null, int $deleted=INode::DELETED_INCLUDE): Generator |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | * Search |
574 | 574 | * |
575 | 575 | * @param array $query |
576 | - * @param array $share |
|
576 | + * @param array $shares |
|
577 | 577 | * @return array |
578 | 578 | */ |
579 | 579 | protected function _searchElastic(array $query, array $shares): array |
@@ -204,14 +204,14 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return Delta |
206 | 206 | */ |
207 | - public function getDelta(): Delta |
|
208 | - { |
|
209 | - if ($this->delta instanceof Delta) { |
|
210 | - return $this->delta; |
|
211 | - } |
|
207 | + public function getDelta(): Delta |
|
208 | + { |
|
209 | + if ($this->delta instanceof Delta) { |
|
210 | + return $this->delta; |
|
211 | + } |
|
212 | 212 | |
213 | - return $this->delta = new Delta($this); |
|
214 | - } |
|
213 | + return $this->delta = new Delta($this); |
|
214 | + } |
|
215 | 215 | |
216 | 216 | |
217 | 217 | /** |
@@ -579,8 +579,8 @@ discard block |
||
579 | 579 | protected function _searchElastic(array $query, array $shares): array |
580 | 580 | { |
581 | 581 | $client = \Elasticsearch\ClientBuilder::create() |
582 | - ->setHosts((array)$this->config->search->hosts->server) |
|
583 | - ->build(); |
|
582 | + ->setHosts((array)$this->config->search->hosts->server) |
|
583 | + ->build(); |
|
584 | 584 | |
585 | 585 | $bool = $query['body']['query']; |
586 | 586 |
@@ -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 |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * @param int $deleted |
296 | 296 | * @return INode |
297 | 297 | */ |
298 | - public function findNodeWithId($id, ?string $class=null, int $deleted=INode::DELETED_INCLUDE): INode |
|
298 | + public function findNodeWithId($id, ? string $class = null, int $deleted = INode::DELETED_INCLUDE) : INode |
|
299 | 299 | { |
300 | 300 | if (!is_string($id) && !($id instanceof ObjectID)) { |
301 | 301 | throw new Exception\InvalidArgument($id.' node id has to be a string or instance of \MongoDB\BSON\ObjectID'); |
@@ -353,13 +353,13 @@ discard block |
||
353 | 353 | * @param string $class Fore check node type |
354 | 354 | * @return INode |
355 | 355 | */ |
356 | - public function findNodeWithPath(string $path='', ?string $class=null): INode |
|
356 | + public function findNodeWithPath(string $path = '', ? string $class = null) : INode |
|
357 | 357 | { |
358 | 358 | if (empty($path) || $path[0] != '/') { |
359 | 359 | $path = '/'.$path; |
360 | 360 | } |
361 | 361 | |
362 | - $last = strlen($path)-1; |
|
362 | + $last = strlen($path) - 1; |
|
363 | 363 | if ($path[$last] == '/') { |
364 | 364 | $path = substr($path, 0, -1); |
365 | 365 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | * @param string $class Fore check node type |
391 | 391 | * @return INode |
392 | 392 | */ |
393 | - public function findNodeWithShareToken(string $token, ?string $class=null): INode |
|
393 | + public function findNodeWithShareToken(string $token, ? string $class = null) : INode |
|
394 | 394 | { |
395 | 395 | $node = $this->db->storage->findOne([ |
396 | 396 | 'sharelink.token' => $token, |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * @param bool $deleted |
435 | 435 | * @return Generator |
436 | 436 | */ |
437 | - public function findNodes(array $id=[], ?string $class=null, int $deleted=INode::DELETED_INCLUDE): Generator |
|
437 | + public function findNodes(array $id = [], ? string $class = null, int $deleted = INode::DELETED_INCLUDE) : Generator |
|
438 | 438 | { |
439 | 439 | $id = (array)$id; |
440 | 440 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | * @param int $deleted |
489 | 489 | * @return array |
490 | 490 | */ |
491 | - public function search(array $query, int $deleted=INode::DELETED_INCLUDE): array |
|
491 | + public function search(array $query, int $deleted = INode::DELETED_INCLUDE): array |
|
492 | 492 | { |
493 | 493 | if ($this->user instanceof User) { |
494 | 494 | $this->user->findNewShares(); |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | ->setHosts((array)$this->config->search->hosts->server) |
583 | 583 | ->build(); |
584 | 584 | |
585 | - $bool = $query['body']['query']; |
|
585 | + $bool = $query['body']['query']; |
|
586 | 586 | |
587 | 587 | $filter1 = []; |
588 | 588 | $filter1['bool']['should'][]['term']['owner'] = (string)$this->user->getId(); |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * @param bool $deleted How to handle deleted node |
651 | 651 | * @return INode |
652 | 652 | */ |
653 | - public function getNode($id=null, $path=null, $class=null, $multiple=false, $allow_root=false, $deleted=null) |
|
653 | + public function getNode($id = null, $path = null, $class = null, $multiple = false, $allow_root = false, $deleted = null) |
|
654 | 654 | { |
655 | 655 | if (empty($id) && empty($path)) { |
656 | 656 | if ($allow_root === true) { |
@@ -766,12 +766,12 @@ discard block |
||
766 | 766 | * @return array |
767 | 767 | */ |
768 | 768 | public function findNodeAttributesWithCustomFilter( |
769 | - ?array $filter = null, |
|
769 | + ? array $filter = null, |
|
770 | 770 | array $attributes = ['_id'], |
771 | - ?int $limit = null, |
|
772 | - ?int &$cursor = null, |
|
773 | - ?bool &$has_more = null, |
|
774 | - ?INode $parent = null) |
|
771 | + ? int $limit = null, |
|
772 | + ? int&$cursor = null, |
|
773 | + ? bool&$has_more = null, |
|
774 | + ? INode $parent = null) |
|
775 | 775 | { |
776 | 776 | $default = [ |
777 | 777 | '_id' => 1, |
@@ -783,13 +783,13 @@ discard block |
||
783 | 783 | |
784 | 784 | $search_attributes = array_merge($default, array_fill_keys($attributes, 1)); |
785 | 785 | $list = []; |
786 | - $result =$this->db->storage->find($filter, [ |
|
786 | + $result = $this->db->storage->find($filter, [ |
|
787 | 787 | 'skip' => $cursor, |
788 | 788 | 'limit' => $limit, |
789 | 789 | 'projection'=> $search_attributes |
790 | 790 | ]); |
791 | 791 | |
792 | - $left =$this->db->storage->count($filter, [ |
|
792 | + $left = $this->db->storage->count($filter, [ |
|
793 | 793 | 'skip' => $cursor, |
794 | 794 | ]); |
795 | 795 |