Passed
Push — master ( 5545f1...83deac )
by Kirill
03:22
created
src/Reactor/src/AbstractDeclaration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,6 +30,6 @@
 block discarded – undo
30 30
      */
31 31
     protected function addIndent(string $string, int $indent = 0): string
32 32
     {
33
-        return str_repeat(self::INDENT, max($indent, 0)) . $string;
33
+        return str_repeat(self::INDENT, max($indent, 0)).$string;
34 34
     }
35 35
 }
Please login to merge, or discard this patch.
src/Reactor/src/NamespaceDeclaration.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     public function addElement(DeclarationInterface $element): NamespaceDeclaration
59 59
     {
60 60
         $this->elements->add($element);
61
-        if ($element instanceof DependedInterface) {
61
+        if ($element instanceof DependedInterface){
62 62
             $this->addUses($element->getDependencies());
63 63
         }
64 64
 
@@ -85,23 +85,23 @@  discard block
 block discarded – undo
85 85
         $result = '';
86 86
         $indentShift = 0;
87 87
 
88
-        if (!$this->docComment->isEmpty()) {
89
-            $result .= $this->docComment->render($indentLevel) . "\n";
88
+        if (!$this->docComment->isEmpty()){
89
+            $result .= $this->docComment->render($indentLevel)."\n";
90 90
         }
91 91
 
92
-        if (!empty($this->getName())) {
93
-            $result .= $this->addIndent("namespace {$this->getName()} {", $indentLevel) . "\n";
92
+        if (!empty($this->getName())){
93
+            $result .= $this->addIndent("namespace {$this->getName()} {", $indentLevel)."\n";
94 94
             $indentShift = 1;
95 95
         }
96 96
 
97
-        if (!empty($this->uses)) {
98
-            $result .= $this->renderUses($indentLevel + $indentShift) . "\n\n";
97
+        if (!empty($this->uses)){
98
+            $result .= $this->renderUses($indentLevel + $indentShift)."\n\n";
99 99
         }
100 100
 
101 101
         $result .= $this->elements->render($indentLevel + $indentShift);
102 102
 
103
-        if (!empty($this->getName())) {
104
-            $result .= "\n" . $this->addIndent('}', $indentLevel);
103
+        if (!empty($this->getName())){
104
+            $result .= "\n".$this->addIndent('}', $indentLevel);
105 105
         }
106 106
 
107 107
         return $result;
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,7 +58,8 @@  discard block
 block discarded – undo
58 58
     public function addElement(DeclarationInterface $element): NamespaceDeclaration
59 59
     {
60 60
         $this->elements->add($element);
61
-        if ($element instanceof DependedInterface) {
61
+        if ($element instanceof DependedInterface)
62
+        {
62 63
             $this->addUses($element->getDependencies());
63 64
         }
64 65
 
@@ -85,22 +86,26 @@  discard block
 block discarded – undo
85 86
         $result = '';
86 87
         $indentShift = 0;
87 88
 
88
-        if (!$this->docComment->isEmpty()) {
89
+        if (!$this->docComment->isEmpty())
90
+        {
89 91
             $result .= $this->docComment->render($indentLevel) . "\n";
90 92
         }
91 93
 
92
-        if (!empty($this->getName())) {
94
+        if (!empty($this->getName()))
95
+        {
93 96
             $result .= $this->addIndent("namespace {$this->getName()} {", $indentLevel) . "\n";
94 97
             $indentShift = 1;
95 98
         }
96 99
 
97
-        if (!empty($this->uses)) {
100
+        if (!empty($this->uses))
101
+        {
98 102
             $result .= $this->renderUses($indentLevel + $indentShift) . "\n\n";
99 103
         }
100 104
 
101 105
         $result .= $this->elements->render($indentLevel + $indentShift);
102 106
 
103
-        if (!empty($this->getName())) {
107
+        if (!empty($this->getName()))
108
+        {
104 109
             $result .= "\n" . $this->addIndent('}', $indentLevel);
105 110
         }
106 111
 
Please login to merge, or discard this patch.
src/Reactor/src/FileDeclaration.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     public function addElement(DeclarationInterface $element): FileDeclaration
107 107
     {
108 108
         $this->elements->add($element);
109
-        if ($element instanceof DependedInterface) {
109
+        if ($element instanceof DependedInterface){
110 110
             $this->addUses($element->getDependencies());
111 111
         }
112 112
 
@@ -132,23 +132,23 @@  discard block
 block discarded – undo
132 132
     {
133 133
         $result = "<?php\n";
134 134
 
135
-        if (!$this->docComment->isEmpty()) {
136
-            $result .= $this->docComment->render($indentLevel) . "\n";
135
+        if (!$this->docComment->isEmpty()){
136
+            $result .= $this->docComment->render($indentLevel)."\n";
137 137
         }
138 138
 
139
-        if ($this->directives !== null && !empty($this->directives->render())) {
140
-            $result .= $this->directives->render() . "\n\n";
139
+        if ($this->directives !== null && !empty($this->directives->render())){
140
+            $result .= $this->directives->render()."\n\n";
141 141
         }
142 142
 
143
-        if (!empty($this->namespace)) {
144
-            if ($this->docComment->isEmpty()) {
143
+        if (!empty($this->namespace)){
144
+            if ($this->docComment->isEmpty()){
145 145
                 $result .= "\n";
146 146
             }
147 147
             $result .= "namespace {$this->namespace};\n\n";
148 148
         }
149 149
 
150
-        if (!empty($this->uses)) {
151
-            $result .= $this->renderUses($indentLevel) . "\n\n";
150
+        if (!empty($this->uses)){
151
+            $result .= $this->renderUses($indentLevel)."\n\n";
152 152
         }
153 153
 
154 154
         $result .= $this->elements->render($indentLevel);
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -106,7 +106,8 @@  discard block
 block discarded – undo
106 106
     public function addElement(DeclarationInterface $element): FileDeclaration
107 107
     {
108 108
         $this->elements->add($element);
109
-        if ($element instanceof DependedInterface) {
109
+        if ($element instanceof DependedInterface)
110
+        {
110 111
             $this->addUses($element->getDependencies());
111 112
         }
112 113
 
@@ -132,22 +133,27 @@  discard block
 block discarded – undo
132 133
     {
133 134
         $result = "<?php\n";
134 135
 
135
-        if (!$this->docComment->isEmpty()) {
136
+        if (!$this->docComment->isEmpty())
137
+        {
136 138
             $result .= $this->docComment->render($indentLevel) . "\n";
137 139
         }
138 140
 
139
-        if ($this->directives !== null && !empty($this->directives->render())) {
141
+        if ($this->directives !== null && !empty($this->directives->render()))
142
+        {
140 143
             $result .= $this->directives->render() . "\n\n";
141 144
         }
142 145
 
143
-        if (!empty($this->namespace)) {
144
-            if ($this->docComment->isEmpty()) {
146
+        if (!empty($this->namespace))
147
+        {
148
+            if ($this->docComment->isEmpty())
149
+            {
145 150
                 $result .= "\n";
146 151
             }
147 152
             $result .= "namespace {$this->namespace};\n\n";
148 153
         }
149 154
 
150
-        if (!empty($this->uses)) {
155
+        if (!empty($this->uses))
156
+        {
151 157
             $result .= $this->renderUses($indentLevel) . "\n\n";
152 158
         }
153 159
 
Please login to merge, or discard this patch.
src/Reactor/src/ClassDeclaration.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
         string $extends = '',
62 62
         array $interfaces = [],
63 63
         string $comment = ''
64
-    ) {
64
+    ){
65 65
         $this->setName($name);
66 66
 
67
-        if (! empty($extends)) {
67
+        if (!empty($extends)){
68 68
             $this->setExtends($extends);
69 69
         }
70 70
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     public function setInterfaces(array $interfaces): ClassDeclaration
158 158
     {
159 159
         $this->interfaces = [];
160
-        foreach ($interfaces as $interface) {
160
+        foreach ($interfaces as $interface){
161 161
             $this->addInterface($interface);
162 162
         }
163 163
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
     public function setTraits(array $traits): ClassDeclaration
204 204
     {
205 205
         $this->traits = [];
206
-        foreach ($traits as $trait) {
206
+        foreach ($traits as $trait){
207 207
             $this->addTrait($trait);
208 208
         }
209 209
 
@@ -293,30 +293,30 @@  discard block
 block discarded – undo
293 293
     {
294 294
         $result = '';
295 295
 
296
-        if (! $this->docComment->isEmpty()) {
297
-            $result .= $this->docComment->render($indentLevel) . "\n";
296
+        if (!$this->docComment->isEmpty()){
297
+            $result .= $this->docComment->render($indentLevel)."\n";
298 298
         }
299 299
 
300 300
         //Class header
301 301
         $header = "class {$this->getName()}";
302 302
 
303 303
         //Rendering extends
304
-        if (! empty($this->extends)) {
304
+        if (!empty($this->extends)){
305 305
             $header .= " extends {$this->extends}";
306 306
         }
307 307
 
308
-        if (! empty($this->interfaces)) {
308
+        if (!empty($this->interfaces)){
309 309
             $interfaces = implode(', ', array_keys($this->interfaces));
310 310
             $header .= " implements {$interfaces}";
311 311
         }
312 312
 
313
-        $result .= $this->addIndent($header, $indentLevel) . "\n";
314
-        $result .= $this->addIndent('{', $indentLevel) . "\n";
313
+        $result .= $this->addIndent($header, $indentLevel)."\n";
314
+        $result .= $this->addIndent('{', $indentLevel)."\n";
315 315
 
316 316
         //Rendering class body
317 317
         $result .= $this->renderBody($indentLevel);
318 318
 
319
-        $result = rtrim($result, "\n") . "\n";
319
+        $result = rtrim($result, "\n")."\n";
320 320
         $result .= $this->addIndent('}', $indentLevel);
321 321
 
322 322
         return $result;
@@ -329,20 +329,20 @@  discard block
 block discarded – undo
329 329
     protected function renderBody(int $indentLevel): string
330 330
     {
331 331
         $result = '';
332
-        if (! empty($this->traits)) {
333
-            $result .= $this->renderTraits($indentLevel + 1) . "\n\n";
332
+        if (!empty($this->traits)){
333
+            $result .= $this->renderTraits($indentLevel + 1)."\n\n";
334 334
         }
335 335
 
336
-        if (! $this->constants->isEmpty()) {
337
-            $result .= $this->constants->render($indentLevel + 1) . "\n\n";
336
+        if (!$this->constants->isEmpty()){
337
+            $result .= $this->constants->render($indentLevel + 1)."\n\n";
338 338
         }
339 339
 
340
-        if (! $this->properties->isEmpty()) {
341
-            $result .= $this->properties->render($indentLevel + 1) . "\n\n";
340
+        if (!$this->properties->isEmpty()){
341
+            $result .= $this->properties->render($indentLevel + 1)."\n\n";
342 342
         }
343 343
 
344
-        if (! $this->methods->isEmpty()) {
345
-            $result .= $this->methods->render($indentLevel + 1) . "\n\n";
344
+        if (!$this->methods->isEmpty()){
345
+            $result .= $this->methods->render($indentLevel + 1)."\n\n";
346 346
         }
347 347
 
348 348
         return $result;
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     private function renderTraits(int $indentLevel = 0): string
356 356
     {
357 357
         $lines = [];
358
-        foreach ($this->traits as $class => $options) {
358
+        foreach ($this->traits as $class => $options){
359 359
             $lines[] = $this->addIndent("use {$class};", $indentLevel);
360 360
         }
361 361
 
Please login to merge, or discard this patch.
Braces   +22 added lines, -11 removed lines patch added patch discarded remove patch
@@ -64,7 +64,8 @@  discard block
 block discarded – undo
64 64
     ) {
65 65
         $this->setName($name);
66 66
 
67
-        if (! empty($extends)) {
67
+        if (! empty($extends))
68
+        {
68 69
             $this->setExtends($extends);
69 70
         }
70 71
 
@@ -157,7 +158,8 @@  discard block
 block discarded – undo
157 158
     public function setInterfaces(array $interfaces): ClassDeclaration
158 159
     {
159 160
         $this->interfaces = [];
160
-        foreach ($interfaces as $interface) {
161
+        foreach ($interfaces as $interface)
162
+        {
161 163
             $this->addInterface($interface);
162 164
         }
163 165
 
@@ -203,7 +205,8 @@  discard block
 block discarded – undo
203 205
     public function setTraits(array $traits): ClassDeclaration
204 206
     {
205 207
         $this->traits = [];
206
-        foreach ($traits as $trait) {
208
+        foreach ($traits as $trait)
209
+        {
207 210
             $this->addTrait($trait);
208 211
         }
209 212
 
@@ -293,7 +296,8 @@  discard block
 block discarded – undo
293 296
     {
294 297
         $result = '';
295 298
 
296
-        if (! $this->docComment->isEmpty()) {
299
+        if (! $this->docComment->isEmpty())
300
+        {
297 301
             $result .= $this->docComment->render($indentLevel) . "\n";
298 302
         }
299 303
 
@@ -301,11 +305,13 @@  discard block
 block discarded – undo
301 305
         $header = "class {$this->getName()}";
302 306
 
303 307
         //Rendering extends
304
-        if (! empty($this->extends)) {
308
+        if (! empty($this->extends))
309
+        {
305 310
             $header .= " extends {$this->extends}";
306 311
         }
307 312
 
308
-        if (! empty($this->interfaces)) {
313
+        if (! empty($this->interfaces))
314
+        {
309 315
             $interfaces = implode(', ', array_keys($this->interfaces));
310 316
             $header .= " implements {$interfaces}";
311 317
         }
@@ -329,19 +335,23 @@  discard block
 block discarded – undo
329 335
     protected function renderBody(int $indentLevel): string
330 336
     {
331 337
         $result = '';
332
-        if (! empty($this->traits)) {
338
+        if (! empty($this->traits))
339
+        {
333 340
             $result .= $this->renderTraits($indentLevel + 1) . "\n\n";
334 341
         }
335 342
 
336
-        if (! $this->constants->isEmpty()) {
343
+        if (! $this->constants->isEmpty())
344
+        {
337 345
             $result .= $this->constants->render($indentLevel + 1) . "\n\n";
338 346
         }
339 347
 
340
-        if (! $this->properties->isEmpty()) {
348
+        if (! $this->properties->isEmpty())
349
+        {
341 350
             $result .= $this->properties->render($indentLevel + 1) . "\n\n";
342 351
         }
343 352
 
344
-        if (! $this->methods->isEmpty()) {
353
+        if (! $this->methods->isEmpty())
354
+        {
345 355
             $result .= $this->methods->render($indentLevel + 1) . "\n\n";
346 356
         }
347 357
 
@@ -355,7 +365,8 @@  discard block
 block discarded – undo
355 365
     private function renderTraits(int $indentLevel = 0): string
356 366
     {
357 367
         $lines = [];
358
-        foreach ($this->traits as $class => $options) {
368
+        foreach ($this->traits as $class => $options)
369
+        {
359 370
             $lines[] = $this->addIndent("use {$class};", $indentLevel);
360 371
         }
361 372
 
Please login to merge, or discard this patch.
src/Reactor/src/Traits/AccessTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
             AbstractDeclaration::ACCESS_PROTECTED,
39 39
             AbstractDeclaration::ACCESS_PUBLIC
40 40
             ], true)
41
-        ) {
41
+        ){
42 42
             throw new ReactorException("Invalid declaration level '{$access}'");
43 43
         }
44 44
 
Please login to merge, or discard this patch.
src/Reactor/src/Traits/CommentTrait.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function setComment($comment): self
44 44
     {
45
-        if (!empty($comment)) {
46
-            if (is_array($comment)) {
45
+        if (!empty($comment)){
46
+            if (is_array($comment)){
47 47
                 $this->docComment->setLines($comment);
48
-            } elseif (is_string($comment)) {
48
+            } elseif (is_string($comment)){
49 49
                 $this->docComment->setString($comment);
50 50
             }
51 51
         }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     private function initComment($comment): void
62 62
     {
63
-        if (empty($this->docComment)) {
63
+        if (empty($this->docComment)){
64 64
             $this->docComment = new Comment();
65 65
         }
66 66
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,10 +42,14 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function setComment($comment): self
44 44
     {
45
-        if (!empty($comment)) {
46
-            if (is_array($comment)) {
45
+        if (!empty($comment))
46
+        {
47
+            if (is_array($comment))
48
+            {
47 49
                 $this->docComment->setLines($comment);
48
-            } elseif (is_string($comment)) {
50
+            }
51
+            elseif (is_string($comment))
52
+            {
49 53
                 $this->docComment->setString($comment);
50 54
             }
51 55
         }
@@ -60,7 +64,8 @@  discard block
 block discarded – undo
60 64
      */
61 65
     private function initComment($comment): void
62 66
     {
63
-        if (empty($this->docComment)) {
67
+        if (empty($this->docComment))
68
+        {
64 69
             $this->docComment = new Comment();
65 70
         }
66 71
 
Please login to merge, or discard this patch.
src/Reactor/src/Traits/UsesTrait.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function addUses(array $uses): self
58 58
     {
59
-        foreach ($uses as $class => $alias) {
59
+        foreach ($uses as $class => $alias){
60 60
             $this->addUse($class, $alias);
61 61
         }
62 62
 
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
     private function renderUses(int $indentLevel = 0): string
113 113
     {
114 114
         $lines = [];
115
-        foreach ($this->getUses() as $class => $alias) {
115
+        foreach ($this->getUses() as $class => $alias){
116 116
             $line = "use {$class}";
117 117
 
118
-            if (!empty($alias)) {
118
+            if (!empty($alias)){
119 119
                 $line .= " as {$alias};";
120
-            } else {
120
+            }else{
121 121
                 $line .= ';';
122 122
             }
123 123
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,8 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function addUses(array $uses): self
58 58
     {
59
-        foreach ($uses as $class => $alias) {
59
+        foreach ($uses as $class => $alias)
60
+        {
60 61
             $this->addUse($class, $alias);
61 62
         }
62 63
 
@@ -112,12 +113,16 @@  discard block
 block discarded – undo
112 113
     private function renderUses(int $indentLevel = 0): string
113 114
     {
114 115
         $lines = [];
115
-        foreach ($this->getUses() as $class => $alias) {
116
+        foreach ($this->getUses() as $class => $alias)
117
+        {
116 118
             $line = "use {$class}";
117 119
 
118
-            if (!empty($alias)) {
120
+            if (!empty($alias))
121
+            {
119 122
                 $line .= " as {$alias};";
120
-            } else {
123
+            }
124
+            else
125
+            {
121 126
                 $line .= ';';
122 127
             }
123 128
 
Please login to merge, or discard this patch.
src/Reactor/src/Serializer.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function serialize($value): string
37 37
     {
38
-        if (is_array($value)) {
38
+        if (is_array($value)){
39 39
             return $this->packArray($value);
40 40
         }
41 41
 
@@ -50,49 +50,49 @@  discard block
 block discarded – undo
50 50
      */
51 51
     protected function packArray(array $array, int $level = 0): string
52 52
     {
53
-        if ($array === []) {
53
+        if ($array === []){
54 54
             return '[]';
55 55
         }
56 56
         //Delimiters between rows and sub-arrays.
57
-        $subIndent = "\n" . str_repeat(self::INDENT, $level + 2);
58
-        $keyIndent = "\n" . str_repeat(self::INDENT, $level + 1);
57
+        $subIndent = "\n".str_repeat(self::INDENT, $level + 2);
58
+        $keyIndent = "\n".str_repeat(self::INDENT, $level + 1);
59 59
         //No keys for associated array
60 60
         $associated = array_diff_key($array, array_keys(array_keys($array)));
61 61
         $result = [];
62 62
         $innerIndent = 0;
63
-        if (!empty($associated)) {
64
-            foreach ($array as $key => $value) {
63
+        if (!empty($associated)){
64
+            foreach ($array as $key => $value){
65 65
                 //Based on biggest key length
66 66
                 $innerIndent = max(strlen(var_export($key, true)), $innerIndent);
67 67
             }
68 68
         }
69
-        foreach ($array as $key => $value) {
69
+        foreach ($array as $key => $value){
70 70
             $prefix = '';
71
-            if (!empty($associated)) {
71
+            if (!empty($associated)){
72 72
                 //Key prefix
73 73
                 $prefix = str_pad(
74 74
                     var_export($key, true),
75 75
                     $innerIndent,
76 76
                     ' ',
77 77
                     STR_PAD_RIGHT
78
-                ) . ' => ';
78
+                ).' => ';
79 79
             }
80
-            if (!is_array($value)) {
81
-                $result[] = $prefix . $this->packValue($value);
80
+            if (!is_array($value)){
81
+                $result[] = $prefix.$this->packValue($value);
82 82
                 continue;
83 83
             }
84
-            if ($value === []) {
85
-                $result[] = $prefix . '[]';
84
+            if ($value === []){
85
+                $result[] = $prefix.'[]';
86 86
                 continue;
87 87
             }
88 88
             $subArray = $this->packArray($value, $level + 1);
89
-            $result[] = $prefix . "[{$subIndent}" . $subArray . "{$keyIndent}]";
89
+            $result[] = $prefix."[{$subIndent}".$subArray."{$keyIndent}]";
90 90
         }
91
-        if ($level !== 0) {
91
+        if ($level !== 0){
92 92
             return $result ? implode(",{$keyIndent}", $result) : '';
93 93
         }
94 94
 
95
-        return "[{$keyIndent}" . implode(",{$keyIndent}", $result) . "\n]";
95
+        return "[{$keyIndent}".implode(",{$keyIndent}", $result)."\n]";
96 96
     }
97 97
 
98 98
     /**
@@ -105,31 +105,31 @@  discard block
 block discarded – undo
105 105
      */
106 106
     protected function packValue($value): string
107 107
     {
108
-        if ($value instanceof DeclarationInterface) {
108
+        if ($value instanceof DeclarationInterface){
109 109
             //No indentation here
110 110
             return $value->render();
111 111
         }
112 112
 
113
-        if ($value === null) {
113
+        if ($value === null){
114 114
             return 'null';
115 115
         }
116 116
 
117
-        if (is_bool($value)) {
117
+        if (is_bool($value)){
118 118
             return ($value ? 'true' : 'false');
119 119
         }
120 120
 
121
-        if (is_object($value) && method_exists($value, '__set_state')) {
122
-            return '\\' . var_export($value, true);
121
+        if (is_object($value) && method_exists($value, '__set_state')){
122
+            return '\\'.var_export($value, true);
123 123
         }
124 124
 
125
-        if (!is_string($value) && !is_numeric($value)) {
125
+        if (!is_string($value) && !is_numeric($value)){
126 126
             throw new SerializeException('Unable to pack non scalar value');
127 127
         }
128 128
 
129
-        if (is_string($value) && class_exists($value)) {
129
+        if (is_string($value) && class_exists($value)){
130 130
             $reflection = new ReflectionClass($value);
131
-            if ($value === $reflection->getName()) {
132
-                return '\\' . $reflection->getName() . '::class';
131
+            if ($value === $reflection->getName()){
132
+                return '\\'.$reflection->getName().'::class';
133 133
             }
134 134
         }
135 135
 
Please login to merge, or discard this patch.
Braces   +32 added lines, -16 removed lines patch added patch discarded remove patch
@@ -35,7 +35,8 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function serialize($value): string
37 37
     {
38
-        if (is_array($value)) {
38
+        if (is_array($value))
39
+        {
39 40
             return $this->packArray($value);
40 41
         }
41 42
 
@@ -50,7 +51,8 @@  discard block
 block discarded – undo
50 51
      */
51 52
     protected function packArray(array $array, int $level = 0): string
52 53
     {
53
-        if ($array === []) {
54
+        if ($array === [])
55
+        {
54 56
             return '[]';
55 57
         }
56 58
         //Delimiters between rows and sub-arrays.
@@ -60,15 +62,19 @@  discard block
 block discarded – undo
60 62
         $associated = array_diff_key($array, array_keys(array_keys($array)));
61 63
         $result = [];
62 64
         $innerIndent = 0;
63
-        if (!empty($associated)) {
64
-            foreach ($array as $key => $value) {
65
+        if (!empty($associated))
66
+        {
67
+            foreach ($array as $key => $value)
68
+            {
65 69
                 //Based on biggest key length
66 70
                 $innerIndent = max(strlen(var_export($key, true)), $innerIndent);
67 71
             }
68 72
         }
69
-        foreach ($array as $key => $value) {
73
+        foreach ($array as $key => $value)
74
+        {
70 75
             $prefix = '';
71
-            if (!empty($associated)) {
76
+            if (!empty($associated))
77
+            {
72 78
                 //Key prefix
73 79
                 $prefix = str_pad(
74 80
                     var_export($key, true),
@@ -77,18 +83,21 @@  discard block
 block discarded – undo
77 83
                     STR_PAD_RIGHT
78 84
                 ) . ' => ';
79 85
             }
80
-            if (!is_array($value)) {
86
+            if (!is_array($value))
87
+            {
81 88
                 $result[] = $prefix . $this->packValue($value);
82 89
                 continue;
83 90
             }
84
-            if ($value === []) {
91
+            if ($value === [])
92
+            {
85 93
                 $result[] = $prefix . '[]';
86 94
                 continue;
87 95
             }
88 96
             $subArray = $this->packArray($value, $level + 1);
89 97
             $result[] = $prefix . "[{$subIndent}" . $subArray . "{$keyIndent}]";
90 98
         }
91
-        if ($level !== 0) {
99
+        if ($level !== 0)
100
+        {
92 101
             return $result ? implode(",{$keyIndent}", $result) : '';
93 102
         }
94 103
 
@@ -105,30 +114,37 @@  discard block
 block discarded – undo
105 114
      */
106 115
     protected function packValue($value): string
107 116
     {
108
-        if ($value instanceof DeclarationInterface) {
117
+        if ($value instanceof DeclarationInterface)
118
+        {
109 119
             //No indentation here
110 120
             return $value->render();
111 121
         }
112 122
 
113
-        if ($value === null) {
123
+        if ($value === null)
124
+        {
114 125
             return 'null';
115 126
         }
116 127
 
117
-        if (is_bool($value)) {
128
+        if (is_bool($value))
129
+        {
118 130
             return ($value ? 'true' : 'false');
119 131
         }
120 132
 
121
-        if (is_object($value) && method_exists($value, '__set_state')) {
133
+        if (is_object($value) && method_exists($value, '__set_state'))
134
+        {
122 135
             return '\\' . var_export($value, true);
123 136
         }
124 137
 
125
-        if (!is_string($value) && !is_numeric($value)) {
138
+        if (!is_string($value) && !is_numeric($value))
139
+        {
126 140
             throw new SerializeException('Unable to pack non scalar value');
127 141
         }
128 142
 
129
-        if (is_string($value) && class_exists($value)) {
143
+        if (is_string($value) && class_exists($value))
144
+        {
130 145
             $reflection = new ReflectionClass($value);
131
-            if ($value === $reflection->getName()) {
146
+            if ($value === $reflection->getName())
147
+            {
132 148
                 return '\\' . $reflection->getName() . '::class';
133 149
             }
134 150
         }
Please login to merge, or discard this patch.
src/Reactor/src/Partial/Comment.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function render(int $indentLevel = 0): string
40 40
     {
41
-        if ($this->isEmpty()) {
41
+        if ($this->isEmpty()){
42 42
             return '';
43 43
         }
44 44
 
45 45
         $result = $this->addIndent("/**\n", $indentLevel);
46
-        foreach ($this->getLines() as $line) {
46
+        foreach ($this->getLines() as $line){
47 47
             $result .= $this->addIndent(" * {$line}\n", $indentLevel);
48 48
         }
49 49
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     protected function prepareLine(string $line): ?string
59 59
     {
60 60
         $line = trim($line);
61
-        if (in_array($line, ['/*', '/**', '*/'], true)) {
61
+        if (in_array($line, ['/*', '/**', '*/'], true)){
62 62
             return null;
63 63
         }
64 64
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,12 +38,14 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function render(int $indentLevel = 0): string
40 40
     {
41
-        if ($this->isEmpty()) {
41
+        if ($this->isEmpty())
42
+        {
42 43
             return '';
43 44
         }
44 45
 
45 46
         $result = $this->addIndent("/**\n", $indentLevel);
46
-        foreach ($this->getLines() as $line) {
47
+        foreach ($this->getLines() as $line)
48
+        {
47 49
             $result .= $this->addIndent(" * {$line}\n", $indentLevel);
48 50
         }
49 51
 
@@ -58,7 +60,8 @@  discard block
 block discarded – undo
58 60
     protected function prepareLine(string $line): ?string
59 61
     {
60 62
         $line = trim($line);
61
-        if (in_array($line, ['/*', '/**', '*/'], true)) {
63
+        if (in_array($line, ['/*', '/**', '*/'], true))
64
+        {
62 65
             return null;
63 66
         }
64 67
 
Please login to merge, or discard this patch.