Completed
Push — master ( 2d4c67...9c9bdc )
by Raffael
08:15
created
src/lib/Balloon/Filesystem/Node/File.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                 'changed' => $this->changed,
185 185
                 'deleted' => $this->deleted,
186 186
                 'thumbnail' => $this->thumbnail,
187
-		'meta' => $this->meta
187
+        'meta' => $this->meta
188 188
             ], INode::CONFLICT_NOACTION, true);
189 189
         }
190 190
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             $v = (array)$version;
211 211
 
212 212
             $v['user'] = (new User($version['user'], $this->_logger, $this->_fs))
213
-              ->getUsername();
213
+                ->getUsername();
214 214
             $v['changed'] = Helper::DateTimeToUnix($version['changed']);
215 215
             $filtered[] = $v;
216 216
         }
@@ -602,15 +602,15 @@  discard block
 block discarded – undo
602 602
         $build = [];
603 603
         foreach ($requested as $key => $attr) {
604 604
             switch ($attr) {
605
-               case 'hash':
605
+                case 'hash':
606 606
                case 'version':
607 607
                case 'thumbnail':
608 608
                    $build[$attr] = $this->{$attr};
609
-               break;
609
+                break;
610 610
             
611
-               case 'history':
611
+                case 'history':
612 612
                    $build['history'] = $this->getHistory();
613
-               break;
613
+                break;
614 614
             }
615 615
         }
616 616
 
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
             //somehow mongo-connector does not catch metadata when set during uploadFromStream()
876 876
             $stream = $bucket->uploadFromStream($id, $contents, ['_id' => $id/*, 'metadata' => $file*/]);
877 877
             $this->_db->{'fs.files'}->updateOne(['_id' => $id], [
878
-              '$set' => ['metadata'=> $file]
878
+                '$set' => ['metadata'=> $file]
879 879
             ]);
880 880
             
881 881
             $this->_logger->info('added new gridfs content node ['.$id.'] for file ['.$this->_id.']', [
Please login to merge, or discard this patch.
src/lib/Balloon/Filesystem/Node/Collection.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                 'changed' => $this->changed,
134 134
                 'deleted' => $this->deleted,
135 135
                 'filter'  => $this->filter,
136
-		'meta' => $this->meta
136
+        'meta' => $this->meta
137 137
             ], INode::CONFLICT_NOACTION, true);
138 138
         }
139 139
 
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
                 'category' => get_class($this),
900 900
             ]);
901 901
             
902
-	    if(!$this->isRoot()) {
902
+        if(!$this->isRoot()) {
903 903
                 $this->changed = $save['changed'];
904 904
                 $this->save('changed');
905 905
             }            
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Balloon
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * @param  bool $force
74 74
      * @return void
75 75
      */
76
-    public function __construct(?BSONDocument $node, Filesystem $fs, bool $force=false)
76
+    public function __construct(?BSONDocument $node, Filesystem $fs, bool $force = false)
77 77
     {
78 78
         parent::__construct($node, $fs);
79 79
         
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
             $this->_id = null;
82 82
 
83 83
             if ($this->_user instanceof User) {
84
-                $this->owner  = $this->_user->getId();
84
+                $this->owner = $this->_user->getId();
85 85
             }
86 86
         }
87 87
             
88
-        if($force === false) {
88
+        if ($force === false) {
89 89
             $this->_verifyAccess();
90 90
         }
91 91
     }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @param  bool $recursion_first
101 101
      * @return INode
102 102
      */
103
-    public function copyTo(Collection $parent, int $conflict=INode::CONFLICT_NOACTION, ?string $recursion=null, bool $recursion_first=true): INode
103
+    public function copyTo(Collection $parent, int $conflict = INode::CONFLICT_NOACTION, ?string $recursion = null, bool $recursion_first = true) : INode
104 104
     {
105 105
         if ($recursion === null) {
106 106
             $recursion_first = true;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      * @param  array|string $attribute
201 201
      * @return array|string
202 202
      */
203
-    public function getAttribute($attribute=[])
203
+    public function getAttribute($attribute = [])
204 204
     {
205 205
         if (empty($attribute)) {
206 206
             $attribute = [
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      * @param   array $filter
247 247
      * @return  Generator
248 248
      */
249
-    public function getChildNodes(int $deleted=INode::DELETED_EXCLUDE, array $filter=[]): Generator
249
+    public function getChildNodes(int $deleted = INode::DELETED_EXCLUDE, array $filter = []): Generator
250 250
     {
251 251
         if ($this->_user instanceof User) {
252 252
             $this->_user->findNewShares();
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         }
299 299
         
300 300
         if (!empty($this->filter)) {
301
-            if(is_string($this->filter)) {
301
+            if (is_string($this->filter)) {
302 302
                 $filter = json_decode($this->filter, true);
303 303
             } else {
304 304
                 $filter = $this->filter;
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
      * @param   array $filter
324 324
      * @return  Generator
325 325
      */
326
-    public function getChildren(int $deleted=INode::DELETED_EXCLUDE, array $filter=[]): array
326
+    public function getChildren(int $deleted = INode::DELETED_EXCLUDE, array $filter = []): array
327 327
     {
328 328
         return iterator_to_array($this->getChildNodes($deleted, $filter));
329 329
     }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
      * @param  array $filter
395 395
      * @return INode
396 396
      */
397
-    public function getChild($node, int $deleted=INode::DELETED_EXCLUDE, array $filter=[]): INode
397
+    public function getChild($node, int $deleted = INode::DELETED_EXCLUDE, array $filter = []): INode
398 398
     {
399 399
         //if $node is string load the object from the backend based on the current parent (the name
400 400
         //is unique per depth, so we can load the object)
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
      * @param   int $deleted
464 464
      * @return  bool
465 465
      */
466
-    protected function doRecursiveAction(string $method, array $params=[], int $deleted=INode::DELETED_EXCLUDE): bool
466
+    protected function doRecursiveAction(string $method, array $params = [], int $deleted = INode::DELETED_EXCLUDE): bool
467 467
     {
468 468
         if (!is_callable([$this, $method])) {
469 469
             throw new Exception("method $method is not callable in ".__CLASS__);
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
      * @param   bool $recursion_first
491 491
      * @return  bool
492 492
      */
493
-    public function delete(bool $force=false, ?string $recursion=null, bool $recursion_first=true): bool
493
+    public function delete(bool $force = false, ?string $recursion = null, bool $recursion_first = true) : bool
494 494
     {
495 495
         if (!$this->isAllowed('w') && !$this->isReference()) {
496 496
             throw new Exception\Forbidden('not allowed to delete node '.$this->name,
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
      * @param   bool $recursion_first
554 554
      * @return  bool
555 555
      */
556
-    protected function _forceDelete(?string $recursion=null, bool $recursion_first=true): bool
556
+    protected function _forceDelete(?string $recursion = null, bool $recursion_first = true) : bool
557 557
     {
558 558
         if (!$this->isReference()) {
559 559
             $this->doRecursiveAction('delete', [
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
      * @param   array $filter
606 606
      * @return  bool
607 607
      */
608
-    public function childExists($name, $deleted=INode::DELETED_EXCLUDE, array $filter=[]): bool
608
+    public function childExists($name, $deleted = INode::DELETED_EXCLUDE, array $filter = []): bool
609 609
     {
610 610
         $find = [
611 611
             'parent'  => $this->getRealId(),
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
         }
740 740
 
741 741
         $this->shared = false;
742
-        $this->acl   = null;
742
+        $this->acl = null;
743 743
         $action = [
744 744
             '$unset' => [
745 745
                 'shared' => $this->_id
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
      * @param   arary $files
800 800
      * @return  array
801 801
      */
802
-    public function getChildrenRecursive(?ObjectId $id=null, ?array &$shares=[], ?array &$files=[]): array
802
+    public function getChildrenRecursive(?ObjectId $id = null, ? array &$shares = [], ? array &$files = []) : array
803 803
     {
804 804
         $list = [];
805 805
         $result = $this->_db->storage->find([
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
      * @param   bool $clone
844 844
      * @return  Collection
845 845
      */
846
-    public function addDirectory($name, array $attributes=[], int $conflict=INode::CONFLICT_NOACTION, bool $clone=false): Collection
846
+    public function addDirectory($name, array $attributes = [], int $conflict = INode::CONFLICT_NOACTION, bool $clone = false): Collection
847 847
     {
848 848
         if (!$this->isAllowed('w')) {
849 849
             throw new Exception\Forbidden('not allowed to create new node here',
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
                 'shared'    => ($this->shared === true ? $this->getRealId() : $this->shared)
891 891
             ];
892 892
 
893
-            $save  = array_merge($meta, $attributes);
893
+            $save = array_merge($meta, $attributes);
894 894
 
895 895
             $result = $this->_db->storage->insertOne($save);
896 896
             $save['_id'] = $result->getInsertedId();
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
                 'category' => get_class($this),
900 900
             ]);
901 901
             
902
-	    if(!$this->isRoot()) {
902
+	    if (!$this->isRoot()) {
903 903
                 $this->changed = $save['changed'];
904 904
                 $this->save('changed');
905 905
             }            
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
      * @param   bool $clone
929 929
      * @return  File
930 930
      */
931
-    public function addFile($name, $data=null, array $attributes=[], int $conflict=INode::CONFLICT_NOACTION, bool $clone=false): File
931
+    public function addFile($name, $data = null, array $attributes = [], int $conflict = INode::CONFLICT_NOACTION, bool $clone = false): File
932 932
     {
933 933
         if (!$this->isAllowed('w')) {
934 934
             throw new Exception\Forbidden('not allowed to create new node here',
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
                 'shared'    => ($this->shared === true ? $this->getRealId() : $this->shared),
979 979
             ];
980 980
 
981
-            $save  = array_merge($meta, $attributes);
981
+            $save = array_merge($meta, $attributes);
982 982
 
983 983
             $result = $this->_db->storage->insertOne($save);
984 984
             $save['_id'] = $result->getInsertedId();
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
                 'category' => get_class($this),
988 988
             ]);
989 989
 
990
-            if(!$this->isRoot()) {
990
+            if (!$this->isRoot()) {
991 991
                 $this->changed = $save['changed'];
992 992
                 $this->save('changed');
993 993
             }            
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
      * @param   string $data
1034 1034
      * @return  File
1035 1035
      */
1036
-    public function createFile($name, $data=null): String
1036
+    public function createFile($name, $data = null): String
1037 1037
     {
1038 1038
         return $this->addFile($name, $data)->getETag();
1039 1039
     }
Please login to merge, or discard this patch.
src/lib/Balloon/Filesystem.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -204,14 +204,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
     {
776 776
         $list   = [];
777 777
         
778
-	$result =$this->db->storage->find($filter, [
778
+    $result =$this->db->storage->find($filter, [
779 779
             'skip'      => $cursor,
780 780
             'limit'     => $limit,
781 781
         ]);
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,21 +766,21 @@  discard block
 block discarded – undo
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 771
         ?int $limit = null,
772 772
         ?int &$cursor = null,
773 773
         ?bool &$has_more = null,
774 774
         ?INode $parent = null)
775 775
     {
776
-        $list   = [];
776
+        $list = [];
777 777
         
778
-	$result =$this->db->storage->find($filter, [
778
+	$result = $this->db->storage->find($filter, [
779 779
             'skip'      => $cursor,
780 780
             'limit'     => $limit,
781 781
         ]);
782 782
         
783
-        $left =$this->db->storage->count($filter, [
783
+        $left = $this->db->storage->count($filter, [
784 784
             'skip' => $cursor,
785 785
         ]);
786 786
 
Please login to merge, or discard this patch.