Passed
Branch master (f6a670)
by Sebastian
07:16 queued 02:32
created
src/HTMLTag/CannedTags.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * @param string|number|StringBuilder_Interface|NULL $content
30 30
      * @return HTMLTag
31 31
      */
32
-    public static function anchor(string $url, $content=null) : HTMLTag
32
+    public static function anchor(string $url, $content = null) : HTMLTag
33 33
     {
34 34
         return HTMLTag::create('a')
35 35
             ->href($url)
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param string|number|StringBuilder_Interface|NULL $content
47 47
      * @return HTMLTag
48 48
      */
49
-    public static function div($content=null) : HTMLTag
49
+    public static function div($content = null) : HTMLTag
50 50
     {
51 51
         return HTMLTag::create('div')->setContent($content);
52 52
     }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @param string|number|StringBuilder_Interface|NULL $content
56 56
      * @return HTMLTag
57 57
      */
58
-    public static function p($content=null) : HTMLTag
58
+    public static function p($content = null) : HTMLTag
59 59
     {
60 60
         return HTMLTag::create('p')->setContent($content);
61 61
     }
Please login to merge, or discard this patch.
src/ConvertHelper/IntervalConverter.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     
37 37
     public function __construct()
38 38
     {
39
-        if(class_exists('\AppLocalize\Localization')) {
39
+        if (class_exists('\AppLocalize\Localization')) {
40 40
             \AppLocalize\Localization::onLocaleChanged(array($this, 'handle_localeChanged'));
41 41
         }
42 42
     }
@@ -69,17 +69,17 @@  discard block
 block discarded – undo
69 69
         $keep = $this->resolveTokens($interval);
70 70
 
71 71
         $parts = array();
72
-        foreach($keep as $token)
72
+        foreach ($keep as $token)
73 73
         {
74 74
             $value = $interval->getToken($token);
75
-            if($value <= 0) {
75
+            if ($value <= 0) {
76 76
                 continue;
77 77
             }
78 78
             
79 79
             $parts[] = $this->translateToken($token, $interval);
80 80
         }
81 81
         
82
-        if(count($parts) == 1) {
82
+        if (count($parts) == 1) {
83 83
             return $parts[0];
84 84
         }
85 85
         
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
         $value = $interval->getToken($token);
102 102
         
103 103
         $suffix = 'p';
104
-        if($value == 1) { $suffix = 's'; }
104
+        if ($value == 1) { $suffix = 's'; }
105 105
         $token .= $suffix;
106 106
         
107
-        if(!isset(self::$texts[$token]))
107
+        if (!isset(self::$texts[$token]))
108 108
         {
109 109
             throw new ConvertHelper_Exception(
110 110
                 'Missing interval translation',
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
     {
135 135
         $offset = 0;
136 136
         
137
-        foreach($this->tokens as $token) 
137
+        foreach ($this->tokens as $token) 
138 138
         {
139
-            if($interval->getToken($token) > 0) 
139
+            if ($interval->getToken($token) > 0) 
140 140
             {
141 141
                 return array_slice($this->tokens, $offset);
142 142
             }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     */
153 153
     protected function initTexts() : void
154 154
     {
155
-        if(isset(self::$texts)) {
155
+        if (isset(self::$texts)) {
156 156
             return;
157 157
         }
158 158
         
Please login to merge, or discard this patch.
src/AttributeCollection.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
     public function setAttributes(array $attributes) : AttributeCollection
48 48
     {
49 49
         // import existing classes
50
-        if(isset($attributes['class']))
50
+        if (isset($attributes['class']))
51 51
         {
52 52
             $this->addClasses(ConvertHelper::explodeTrim(' ', $attributes['class']));
53 53
             unset($attributes['class']);
54 54
         }
55 55
 
56
-        foreach($attributes as $name => $value)
56
+        foreach ($attributes as $name => $value)
57 57
         {
58 58
             $this->attr($name, $value);
59 59
         }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         return $this;
62 62
     }
63 63
 
64
-    public function getAttribute(string $name, string $default='') : string
64
+    public function getAttribute(string $name, string $default = '') : string
65 65
     {
66 66
         return $this->attributes[$name] ?? $default;
67 67
     }
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
      * @param array<string,string|number> $attributes
71 71
      * @return AttributeCollection
72 72
      */
73
-    public static function create(array $attributes=array()) : AttributeCollection
73
+    public static function create(array $attributes = array()) : AttributeCollection
74 74
     {
75 75
         return new AttributeCollection($attributes);
76 76
     }
77 77
 
78
-    public function prop(string $name, bool $enabled=true) : AttributeCollection
78
+    public function prop(string $name, bool $enabled = true) : AttributeCollection
79 79
     {
80
-        if($enabled)
80
+        if ($enabled)
81 81
         {
82 82
             return $this->attr($name, $name);
83 83
         }
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function attr(string $name, $value) : AttributeCollection
94 94
     {
95
-        if($value === true)
95
+        if ($value === true)
96 96
         {
97 97
             $string = 'true';
98 98
         }
99
-        else if($value === false)
99
+        else if ($value === false)
100 100
         {
101 101
             $string = 'false';
102 102
         }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             $string = (string)$value;
106 106
         }
107 107
 
108
-        if($string !== '')
108
+        if ($string !== '')
109 109
         {
110 110
             $this->attributes[$name] = $string;
111 111
         }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     {
125 125
         $this->attr($name, $value);
126 126
 
127
-        if(isset($this->attributes[$name]))
127
+        if (isset($this->attributes[$name]))
128 128
         {
129 129
             $this->attributes[$name] = Filtering::quotes($this->attributes[$name]);
130 130
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
     public function remove(string $name) : AttributeCollection
141 141
     {
142
-        if(isset($this->attributes[$name]))
142
+        if (isset($this->attributes[$name]))
143 143
         {
144 144
             unset($this->attributes[$name]);
145 145
         }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     {
164 164
         $attributes = $this->attributes;
165 165
 
166
-        if($this->hasClasses())
166
+        if ($this->hasClasses())
167 167
         {
168 168
             $attributes['class'] = $this->classesToString();
169 169
         }
@@ -177,14 +177,14 @@  discard block
 block discarded – undo
177 177
 
178 178
         $attributes = $this->getAttributes();
179 179
 
180
-        if(empty($attributes))
180
+        if (empty($attributes))
181 181
         {
182 182
             return '';
183 183
         }
184 184
 
185
-        foreach($attributes as $name => $value)
185
+        foreach ($attributes as $name => $value)
186 186
         {
187
-            if($value === '')
187
+            if ($value === '')
188 188
             {
189 189
                 continue;
190 190
             }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
     private function renderAttribute(string $name, string $value) : string
199 199
     {
200
-        if($name === $value)
200
+        if ($name === $value)
201 201
         {
202 202
             return $name;
203 203
         }
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
     public const TARGET_BLANK = '_blank';
242 242
 
243
-    public function target(string $value=self::TARGET_BLANK) : AttributeCollection
243
+    public function target(string $value = self::TARGET_BLANK) : AttributeCollection
244 244
     {
245 245
         return $this->attr('target', $value);
246 246
     }
Please login to merge, or discard this patch.
src/FileHelper/PHPClassInfo.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $this->path = realpath($path);
55 55
         
56
-        if($this->path === false)
56
+        if ($this->path === false)
57 57
         {
58 58
             throw new FileHelper_Exception(
59 59
                 'Cannot extract file information: file not found.',
@@ -131,25 +131,25 @@  discard block
 block discarded – undo
131 131
 
132 132
         $result = array();
133 133
         preg_match_all('/namespace[\s]+([^;]+);/six', $code, $result, PREG_PATTERN_ORDER);
134
-        if(isset($result[0]) && isset($result[0][0])) {
134
+        if (isset($result[0]) && isset($result[0][0])) {
135 135
             $this->namespace = trim($result[1][0]);
136 136
         }
137 137
         
138 138
         $result = array();
139 139
         preg_match_all('/(abstract|final)[\s]+(class|trait)[\s]+([\sa-z0-9\\\\_,]+){|(class|trait)[\s]+([\sa-z0-9\\\\_,]+){/six', $code, $result, PREG_PATTERN_ORDER);
140 140
 
141
-        if(!isset($result[0]) || !isset($result[0][0])) {
141
+        if (!isset($result[0]) || !isset($result[0][0])) {
142 142
             return;
143 143
         }
144 144
         
145 145
         $indexes = array_keys($result[0]);
146 146
         
147
-        foreach($indexes as $idx)
147
+        foreach ($indexes as $idx)
148 148
         {
149 149
             $keyword = $result[1][$idx];
150 150
             $declaration = $result[3][$idx];
151 151
             $type = $result[2][$idx];
152
-            if(empty($keyword)) {
152
+            if (empty($keyword)) {
153 153
                 $type = $result[4][$idx];
154 154
                 $declaration = $result[5][$idx];
155 155
             }
Please login to merge, or discard this patch.
src/FileHelper/PHPClassInfo/Class.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $name = $this->getName();
113 113
         
114
-        if($this->info->hasNamespace()) {
114
+        if ($this->info->hasNamespace()) {
115 115
             $name = $this->info->getNamespace().'\\'.$this->name;
116 116
         }
117 117
         
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
         $parts[] = $this->type;
167 167
         $parts[] = $this->getName();
168 168
         
169
-        if(!empty($this->extends)) {
169
+        if (!empty($this->extends)) {
170 170
             $parts[] = 'extends';
171 171
             $parts[] = $this->extends;
172 172
         }
173 173
         
174
-        if(!empty($this->implements)) {
174
+        if (!empty($this->implements)) {
175 175
             $parts[] = 'implements';
176 176
             $parts[] = implode(', ', $this->implements);
177 177
         }
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 
196 196
     protected function analyzeCode() : void
197 197
     {
198
-        if($this->keyword === 'abstract') {
198
+        if ($this->keyword === 'abstract') {
199 199
             $this->abstract = true;
200
-        } else if($this->keyword === 'final') {
200
+        } else if ($this->keyword === 'final') {
201 201
             $this->final = true;
202 202
         }
203 203
         
@@ -214,16 +214,16 @@  discard block
 block discarded – undo
214 214
         
215 215
         $tokenName = 'none';
216 216
         
217
-        foreach($parts as $part)
217
+        foreach ($parts as $part)
218 218
         {
219 219
             $part = str_replace(',', '', $part);
220 220
             $part = trim($part);
221
-            if(empty($part)) {
221
+            if (empty($part)) {
222 222
                 continue;
223 223
             }
224 224
             
225 225
             $name = strtolower($part);
226
-            if($name === 'extends' || $name === 'implements') {
226
+            if ($name === 'extends' || $name === 'implements') {
227 227
                 $tokenName = $name;
228 228
                 continue;
229 229
             }
@@ -233,13 +233,13 @@  discard block
 block discarded – undo
233 233
         
234 234
         $this->implements = $tokens['implements'];
235 235
         
236
-        if(!empty($this->implements)) {
236
+        if (!empty($this->implements)) {
237 237
             usort($this->implements, function(string $a, string $b) {
238 238
                 return strnatcasecmp($a, $b);
239 239
             });
240 240
         }
241 241
         
242
-        if(!empty($tokens['extends'])) {
242
+        if (!empty($tokens['extends'])) {
243 243
             $this->extends = $tokens['extends'][0];
244 244
         }
245 245
     }
Please login to merge, or discard this patch.
src/StringBuilder.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $string = (string)$string;
74 74
         
75
-        if(!empty($string)) 
75
+        if (!empty($string)) 
76 76
         {
77 77
             $this->strings[] = $string;
78 78
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $flattened = (string)$string;
92 92
 
93
-        if($flattened !== "")
93
+        if ($flattened !== "")
94 94
         {
95 95
             $this->add($this->noSpace.$flattened);
96 96
         }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     */
157 157
     public function t(string $format, ...$arguments) : StringBuilder
158 158
     {
159
-        if(!class_exists('\AppLocalize\Localization'))
159
+        if (!class_exists('\AppLocalize\Localization'))
160 160
         {
161 161
             array_unshift($arguments, $format);
162 162
             return $this->sf(...$arguments);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     {
182 182
         unset($context); // Only used by the localization parser.
183 183
 
184
-        if(!class_exists('\AppLocalize\Localization'))
184
+        if (!class_exists('\AppLocalize\Localization'))
185 185
         {
186 186
             array_unshift($arguments, $format);
187 187
             return $this->sf(...$arguments);
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
     * @param StringBuilder_Interface|string|NULL $content
340 340
     * @return $this
341 341
     */
342
-    public function para($content=null) : StringBuilder
342
+    public function para($content = null) : StringBuilder
343 343
     {
344
-        if($content !== null) {
344
+        if ($content !== null) {
345 345
             return $this->html('<p>')->nospace($content)->html('</p>');
346 346
         }
347 347
 
@@ -357,21 +357,21 @@  discard block
 block discarded – undo
357 357
      * @param AttributeCollection|null $attributes
358 358
      * @return $this
359 359
      */
360
-    public function link(string $label, string $url, bool $newTab=false, ?AttributeCollection $attributes=null) : StringBuilder
360
+    public function link(string $label, string $url, bool $newTab = false, ?AttributeCollection $attributes = null) : StringBuilder
361 361
     {
362 362
         return $this->add($this->createLink($label, $url, $newTab, $attributes));
363 363
     }
364 364
 
365
-    private function createLink(string $label, string $url, bool $newTab=false, ?AttributeCollection $attributes=null) : HTMLTag
365
+    private function createLink(string $label, string $url, bool $newTab = false, ?AttributeCollection $attributes = null) : HTMLTag
366 366
     {
367
-        if($attributes === null)
367
+        if ($attributes === null)
368 368
         {
369 369
             $attributes = AttributeCollection::create();
370 370
         }
371 371
 
372 372
         $attributes->href($url);
373 373
 
374
-        if($newTab)
374
+        if ($newTab)
375 375
         {
376 376
             $attributes->target();
377 377
         }
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
             ->addText($label);
381 381
     }
382 382
 
383
-    public function linkOpen(string $url, bool $newTab=false, ?AttributeCollection $attributes=null) : StringBuilder
383
+    public function linkOpen(string $url, bool $newTab = false, ?AttributeCollection $attributes = null) : StringBuilder
384 384
     {
385 385
         return $this->html($this->createLink('', $url, $newTab, $attributes)->renderOpen());
386 386
     }
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     */
425 425
     public function spanned($string, $classes) : StringBuilder
426 426
     {
427
-        if(!is_array($classes)) 
427
+        if (!is_array($classes)) 
428 428
         {
429 429
             $classes = array((string)$classes);
430 430
         }
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
      */
451 451
     public function ifTrue(bool $condition, $content) : StringBuilder
452 452
     {
453
-        if($condition === true)
453
+        if ($condition === true)
454 454
         {
455 455
             $this->add($this->renderContent($content));
456 456
         }
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
      */
473 473
     public function ifFalse(bool $condition, $string) : StringBuilder
474 474
     {
475
-        if($condition === false)
475
+        if ($condition === false)
476 476
         {
477 477
             $this->add($this->renderContent($string));
478 478
         }
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
      */
557 557
     public function ifOr(bool $condition, $ifTrue, $ifFalse) : StringBuilder
558 558
     {
559
-        if($condition === true)
559
+        if ($condition === true)
560 560
         {
561 561
             return $this->add($this->renderContent($ifTrue));
562 562
         }
Please login to merge, or discard this patch.