Passed
Push — master ( 8e9a4b...0b4ca3 )
by Sebastian
03:12
created
src/StyleCollection.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     /**
34 34
      * @param array<string,string|number|NumberInfo|Interface_Stringable|NULL> $styles
35 35
      */
36
-    public function __construct(array $styles=array())
36
+    public function __construct(array $styles = array())
37 37
     {
38 38
         $this->options = new StyleOptions();
39 39
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @param array<string,string|number|NumberInfo|Interface_Stringable|NULL> $styles
45 45
      * @return StyleCollection
46 46
      */
47
-    public static function create(array $styles=array()) : StyleCollection
47
+    public static function create(array $styles = array()) : StyleCollection
48 48
     {
49 49
         return new StyleCollection($styles);
50 50
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $lines = explode(';', $string);
70 70
 
71
-        foreach($lines as $line)
71
+        foreach ($lines as $line)
72 72
         {
73 73
             $parts = explode(':', $line);
74 74
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function setStyles(array $styles) : StyleCollection
91 91
     {
92
-        foreach($styles as $name => $value)
92
+        foreach ($styles as $name => $value)
93 93
         {
94 94
             $this->styleAuto($name, $value);
95 95
         }
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
      * @param bool $important
106 106
      * @return $this
107 107
      */
108
-    public function style(string $name, string $value, bool $important=false) : StyleCollection
108
+    public function style(string $name, string $value, bool $important = false) : StyleCollection
109 109
     {
110
-        if($value === '')
110
+        if ($value === '')
111 111
         {
112 112
             return $this;
113 113
         }
114 114
 
115
-        if($important && stripos($value, '!important') === false)
115
+        if ($important && stripos($value, '!important') === false)
116 116
         {
117 117
             $value .= ' !important';
118 118
         }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
      * @param bool $important
131 131
      * @return $this
132 132
      */
133
-    public function styleAuto(string $name, $value, bool $important=false) : StyleCollection
133
+    public function styleAuto(string $name, $value, bool $important = false) : StyleCollection
134 134
     {
135
-        if($value instanceof NumberInfo)
135
+        if ($value instanceof NumberInfo)
136 136
         {
137 137
             return $this->style($name, $value->toCSS(), $important);
138 138
         }
@@ -140,22 +140,22 @@  discard block
 block discarded – undo
140 140
         return $this->style($name, (string)$value, $important);
141 141
     }
142 142
 
143
-    public function stylePX(string $name, int $px, bool $important=false) : StyleCollection
143
+    public function stylePX(string $name, int $px, bool $important = false) : StyleCollection
144 144
     {
145 145
         return $this->style($name, $px.'px', $important);
146 146
     }
147 147
 
148
-    public function stylePercent(string $name, float $percent, bool $important=false) : StyleCollection
148
+    public function stylePercent(string $name, float $percent, bool $important = false) : StyleCollection
149 149
     {
150 150
         return $this->style($name, $percent.'%', $important);
151 151
     }
152 152
 
153
-    public function styleEM(string $name, float $em, bool $important=false) : StyleCollection
153
+    public function styleEM(string $name, float $em, bool $important = false) : StyleCollection
154 154
     {
155 155
         return $this->style($name, $em.'em', $important);
156 156
     }
157 157
 
158
-    public function styleREM(string $name, float $em, bool $important=false) : StyleCollection
158
+    public function styleREM(string $name, float $em, bool $important = false) : StyleCollection
159 159
     {
160 160
         return $this->style($name, $em.'rem', $important);
161 161
     }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      * @param bool $important
170 170
      * @return $this
171 171
      */
172
-    public function styleParseNumber(string $name, $value, bool $important=false) : StyleCollection
172
+    public function styleParseNumber(string $name, $value, bool $important = false) : StyleCollection
173 173
     {
174 174
         return $this->styleNumber($name, parseNumber($value), $important);
175 175
     }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      * @param bool $important
183 183
      * @return $this
184 184
      */
185
-    public function styleNumber(string $name, NumberInfo $info, bool $important=false) : StyleCollection
185
+    public function styleNumber(string $name, NumberInfo $info, bool $important = false) : StyleCollection
186 186
     {
187 187
         $this->style($name, $info->toCSS(), $important);
188 188
         return $this;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
     public function remove(string $name) : StyleCollection
192 192
     {
193
-        if(isset($this->styles[$name]))
193
+        if (isset($this->styles[$name]))
194 194
         {
195 195
             unset($this->styles[$name]);
196 196
         }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     {
227 227
         $all = self::create();
228 228
 
229
-        foreach($collections as $collection)
229
+        foreach ($collections as $collection)
230 230
         {
231 231
             $all->mergeWith($collection);
232 232
         }
Please login to merge, or discard this patch.
src/BaseException.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 {
26 26
     protected ?string $details = null;
27 27
     
28
-   /**
29
-    * @param string $message
30
-    * @param string|NULL $details
31
-    * @param int|NULL $code
32
-    * @param Throwable|NULL $previous
33
-    */
28
+    /**
29
+     * @param string $message
30
+     * @param string|NULL $details
31
+     * @param int|NULL $code
32
+     * @param Throwable|NULL $previous
33
+     */
34 34
     public function __construct(string $message, ?string $details=null, ?int $code=null, ?Throwable $previous=null)
35 35
     {
36 36
         if(defined('APP_UTILS_TESTSUITE') && APP_UTILS_TESTSUITE === 'true')
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
         if($code === null)
42 42
         {
43
-             $code = 0;
43
+                $code = 0;
44 44
         }
45 45
 
46 46
         parent::__construct($message, (int)$code, $previous);
@@ -48,18 +48,18 @@  discard block
 block discarded – undo
48 48
         $this->details = $details;
49 49
     }
50 50
     
51
-   /**
52
-    * Retrieves the detailed error description, if any.
53
-    * @return string
54
-    */
51
+    /**
52
+     * Retrieves the detailed error description, if any.
53
+     * @return string
54
+     */
55 55
     public function getDetails() : string
56 56
     {
57 57
         return $this->details ?? '';
58 58
     }
59 59
     
60
-   /**
61
-    * Displays pertinent information on the exception.
62
-    */
60
+    /**
61
+     * Displays pertinent information on the exception.
62
+     */
63 63
     public function display() : void
64 64
     {
65 65
         if(!headers_sent()) {
@@ -69,20 +69,20 @@  discard block
 block discarded – undo
69 69
         echo $this->getInfo();
70 70
     }
71 71
     
72
-   /**
73
-    * Retrieves information on the exception that can be
74
-    * easily accessed.
75
-    * 
76
-    * @return ConvertHelper_ThrowableInfo
77
-    */
72
+    /**
73
+     * Retrieves information on the exception that can be
74
+     * easily accessed.
75
+     * 
76
+     * @return ConvertHelper_ThrowableInfo
77
+     */
78 78
     public function getInfo() : ConvertHelper_ThrowableInfo
79 79
     {
80 80
         return ConvertHelper::throwable2info($this);
81 81
     }
82 82
     
83
-   /**
84
-    * Dumps a current PHP function trace, as a text only string.
85
-    */
83
+    /**
84
+     * Dumps a current PHP function trace, as a text only string.
85
+     */
86 86
     public static function dumpTraceAsString() : void
87 87
     {
88 88
         try
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
         }
96 96
     }
97 97
 
98
-   /**
99
-    * Dumps a current PHP function trace, with HTML styling.
100
-    */
98
+    /**
99
+     * Dumps a current PHP function trace, with HTML styling.
100
+     */
101 101
     public static function dumpTraceAsHTML() : void
102 102
     {
103 103
         try
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
         }
113 113
     }
114 114
     
115
-   /**
116
-    * Creates an exception info instance from a throwable instance.
117
-    * 
118
-    * @param Throwable $e
119
-    * @return ConvertHelper_ThrowableInfo
120
-    * @see ConvertHelper::throwable2info()
121
-    */
115
+    /**
116
+     * Creates an exception info instance from a throwable instance.
117
+     * 
118
+     * @param Throwable $e
119
+     * @return ConvertHelper_ThrowableInfo
120
+     * @see ConvertHelper::throwable2info()
121
+     */
122 122
     public static function createInfo(Throwable $e) : ConvertHelper_ThrowableInfo
123 123
     {
124 124
         return ConvertHelper::throwable2info($e);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
     * @param int|NULL $code
32 32
     * @param Throwable|NULL $previous
33 33
     */
34
-    public function __construct(string $message, ?string $details=null, ?int $code=null, ?Throwable $previous=null)
34
+    public function __construct(string $message, ?string $details = null, ?int $code = null, ?Throwable $previous = null)
35 35
     {
36
-        if(defined('APP_UTILS_TESTSUITE') && APP_UTILS_TESTSUITE === 'true')
36
+        if (defined('APP_UTILS_TESTSUITE') && APP_UTILS_TESTSUITE === 'true')
37 37
         {
38 38
             $message .= PHP_EOL.$details;
39 39
         }
40 40
 
41
-        if($code === null)
41
+        if ($code === null)
42 42
         {
43 43
              $code = 0;
44 44
         }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     */
63 63
     public function display() : void
64 64
     {
65
-        if(!headers_sent()) {
65
+        if (!headers_sent()) {
66 66
             header('Content-type:text/plain; charset=utf-8');
67 67
         }
68 68
         
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         {
90 90
             throw new BaseException('');
91 91
         }
92
-        catch(BaseException $e) 
92
+        catch (BaseException $e) 
93 93
         {
94 94
             echo self::createInfo($e)->toString();
95 95
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         {
105 105
             throw new BaseException('');
106 106
         }
107
-        catch(BaseException $e)
107
+        catch (BaseException $e)
108 108
         {
109 109
             echo '<pre style="background:#fff;font-family:monospace;font-size:14px;color:#444;padding:16px;border:solid 1px #999;border-radius:4px;">';
110 110
             echo self::createInfo($e)->toString();
Please login to merge, or discard this patch.
src/ClassHelper.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
         // get_class() used to build a class name.
44 44
         $legacyName = str_replace('\\', '_', $legacyName);
45 45
 
46
-        if(class_exists($legacyName))
46
+        if (class_exists($legacyName))
47 47
         {
48 48
             return $legacyName;
49 49
         }
50 50
 
51 51
         $nameNS = str_replace('_', '\\', $legacyName);
52 52
 
53
-        if(class_exists($nameNS))
53
+        if (class_exists($nameNS))
54 54
         {
55 55
             return ltrim($nameNS, '\\');
56 56
         }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     {
71 71
         $class = self::resolveClassName($legacyName);
72 72
 
73
-        if($class !== null)
73
+        if ($class !== null)
74 74
         {
75 75
             return $class;
76 76
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public static function requireClassExists(string $className) : void
92 92
     {
93
-        if(class_exists($className))
93
+        if (class_exists($className))
94 94
         {
95 95
             return;
96 96
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         self::requireClassExists($targetClass);
116 116
         self::requireClassExists($extendsClass);
117 117
 
118
-        if(is_a($targetClass, $extendsClass, true))
118
+        if (is_a($targetClass, $extendsClass, true))
119 119
         {
120 120
             return;
121 121
         }
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
      * @throws ClassNotExistsException
137 137
      * @throws ClassNotImplementsException
138 138
      */
139
-    public static function requireObjectInstanceOf(string $class, object $object, int $errorCode=0)
139
+    public static function requireObjectInstanceOf(string $class, object $object, int $errorCode = 0)
140 140
     {
141
-        if(!class_exists($class) && !interface_exists($class) && !trait_exists($class))
141
+        if (!class_exists($class) && !interface_exists($class) && !trait_exists($class))
142 142
         {
143 143
             throw new ClassNotExistsException($class, $errorCode);
144 144
         }
145 145
 
146
-        if(is_a($object, $class, true))
146
+        if (is_a($object, $class, true))
147 147
         {
148 148
             return $object;
149 149
         }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      */
165 165
     public static function getClassLoader() : ClassLoader
166 166
     {
167
-        if(isset(self::$classLoader)) {
167
+        if (isset(self::$classLoader)) {
168 168
             return self::$classLoader;
169 169
         }
170 170
 
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
 
179 179
         $autoloadFile = null;
180 180
 
181
-        foreach($paths as $path)
181
+        foreach ($paths as $path)
182 182
         {
183
-            if(file_exists($path)) {
183
+            if (file_exists($path)) {
184 184
                 $autoloadFile = $path;
185 185
             }
186 186
         }
187 187
 
188
-        if($autoloadFile === null) {
188
+        if ($autoloadFile === null) {
189 189
             throw new ClassLoaderNotFoundException($paths);
190 190
         }
191 191
 
Please login to merge, or discard this patch.
src/ClassHelper/ClassNotExistsException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 
23 23
     public function __construct(string $class, ?int $code = null, ?Throwable $previous = null)
24 24
     {
25
-        if($code === null || $code === 0) {
25
+        if ($code === null || $code === 0) {
26 26
             $code = self::ERROR_CODE;
27 27
         }
28 28
 
Please login to merge, or discard this patch.