Passed
Push — master ( aecd40...074997 )
by Sebastian
10:13 queued 07:17
created
src/ConvertHelper/StorageSizeEnum/Size.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -25,34 +25,34 @@
 block discarded – undo
25 25
  */
26 26
 class ConvertHelper_StorageSizeEnum_Size
27 27
 {
28
-   /**
29
-    * @var string
30
-    */
28
+    /**
29
+     * @var string
30
+     */
31 31
     protected $name;
32 32
     
33
-   /**
34
-    * @var int
35
-    */
33
+    /**
34
+     * @var int
35
+     */
36 36
     protected $base;
37 37
     
38
-   /**
39
-    * @var int
40
-    */
38
+    /**
39
+     * @var int
40
+     */
41 41
     protected $exponent;
42 42
     
43
-   /**
44
-    * @var string
45
-    */
43
+    /**
44
+     * @var string
45
+     */
46 46
     protected $singular;
47 47
     
48
-   /**
49
-    * @var string
50
-    */
48
+    /**
49
+     * @var string
50
+     */
51 51
     protected $plural;
52 52
     
53
-   /**
54
-    * @var string
55
-    */
53
+    /**
54
+     * @var string
55
+     */
56 56
     protected $suffix;
57 57
     
58 58
     public function __construct(string $name, int $base, int $exponent, string $suffix, string $singular, string $plural)
Please login to merge, or discard this patch.
src/ConvertHelper/SizeNotation.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     * @return string
100 100
     * @see ConvertHelper::bytes2readable()
101 101
     */
102
-    public function toString(int $precision=1) : string
102
+    public function toString(int $precision = 1) : string
103 103
     {
104 104
         return ConvertHelper::bytes2readable($this->bytes, $precision, $this->getBase());
105 105
     }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     */
111 111
     public function getBase() : int
112 112
     {
113
-        if($this->isValid()) {
113
+        if ($this->isValid()) {
114 114
             return $this->sizeDefinition->getBase(); 
115 115
         }
116 116
         
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     */
127 127
     public function getSizeDefinition() : ?ConvertHelper_StorageSizeEnum_Size
128 128
     {
129
-        if($this->isValid()) {
129
+        if ($this->isValid()) {
130 130
             return $this->sizeDefinition;
131 131
         }
132 132
         
@@ -175,18 +175,18 @@  discard block
 block discarded – undo
175 175
     
176 176
     protected function parseSize() : void
177 177
     {
178
-        if(!$this->detectParts()) {
178
+        if (!$this->detectParts()) {
179 179
             return;
180 180
         }
181 181
         
182 182
         // we detected units in the string: all good.
183
-        if($this->units !== null)
183
+        if ($this->units !== null)
184 184
         {
185 185
             return;
186 186
         }
187 187
         
188 188
         // just a numeric value: we assume this means we're dealing with bytes.
189
-        if(is_numeric($this->number)) 
189
+        if (is_numeric($this->number)) 
190 190
         {
191 191
             $this->units = 'b';
192 192
             return;
@@ -212,12 +212,12 @@  discard block
 block discarded – undo
212 212
         
213 213
         $number = $this->sizeString;
214 214
         
215
-        foreach($units as $unit)
215
+        foreach ($units as $unit)
216 216
         {
217
-            if(stristr($number, $unit))
217
+            if (stristr($number, $unit))
218 218
             {
219 219
                 // there are more than 1 unit defined in the string
220
-                if($this->units !== null)
220
+                if ($this->units !== null)
221 221
                 {
222 222
                     $this->setError(
223 223
                         t(
@@ -273,14 +273,14 @@  discard block
 block discarded – undo
273 273
     {
274 274
         $this->parseSize();
275 275
         
276
-        if(!$this->valid) {
276
+        if (!$this->valid) {
277 277
             return;
278 278
         }
279 279
         
280 280
         $int = intval($this->number);
281 281
         
282 282
         // negative values
283
-        if($int < 0) 
283
+        if ($int < 0) 
284 284
         {
285 285
             $this->setError(
286 286
                 t('Negative values cannot be used as size.'),
Please login to merge, or discard this patch.
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
     
32 32
     public const VALIDATION_ERROR_NEGATIVE_VALUE = 43803;
33 33
     
34
-   /**
35
-    * @var string
36
-    */
34
+    /**
35
+     * @var string
36
+     */
37 37
     protected $sizeString;
38 38
 
39 39
     /**
@@ -41,44 +41,44 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected $sizeDefinition;
43 43
     
44
-   /**
45
-    * @var integer
46
-    */
44
+    /**
45
+     * @var integer
46
+     */
47 47
     protected $bytes = 0;
48 48
     
49
-   /**
50
-    * @var bool
51
-    */
49
+    /**
50
+     * @var bool
51
+     */
52 52
     protected $valid = true;
53 53
     
54
-   /**
55
-    * @var string
56
-    */
54
+    /**
55
+     * @var string
56
+     */
57 57
     protected $units = null;
58 58
     
59
-   /**
60
-    * @var string
61
-    */
59
+    /**
60
+     * @var string
61
+     */
62 62
     protected $number = '';
63 63
     
64
-   /**
65
-    * @var string
66
-    */
64
+    /**
65
+     * @var string
66
+     */
67 67
     protected $errorMessage = '';
68 68
     
69
-   /**
70
-    * @var int
71
-    */
69
+    /**
70
+     * @var int
71
+     */
72 72
     protected $errorCode = 0;
73 73
     
74
-   /**
75
-    * Create a new instance for the specified size string.
76
-    * 
77
-    * @param string $sizeString A size notation in the format "50 MB", or a number of bytes without units. Spaces are ignored, so "50MB" = "50 MB" = "  50   MB   ". Floating point values are accepted, both with dot and comma notation ("50.5" = "50,5"). To use Base 2 values, ose appropriate units, e.g. "50 MiB", "1.5 GiB". The units are case-insensitive, so "50 MB" = "50 mb".
78
-    *
79
-    * @throws ConvertHelper_Exception
80
-    * @see ConvertHelper_StorageSizeEnum::ERROR_UNKNOWN_UNIT_NAME
81
-    */
74
+    /**
75
+     * Create a new instance for the specified size string.
76
+     * 
77
+     * @param string $sizeString A size notation in the format "50 MB", or a number of bytes without units. Spaces are ignored, so "50MB" = "50 MB" = "  50   MB   ". Floating point values are accepted, both with dot and comma notation ("50.5" = "50,5"). To use Base 2 values, ose appropriate units, e.g. "50 MiB", "1.5 GiB". The units are case-insensitive, so "50 MB" = "50 mb".
78
+     *
79
+     * @throws ConvertHelper_Exception
80
+     * @see ConvertHelper_StorageSizeEnum::ERROR_UNKNOWN_UNIT_NAME
81
+     */
82 82
     public function __construct(string $sizeString)
83 83
     {
84 84
         $this->sizeString = $this->cleanString($sizeString);
@@ -86,31 +86,31 @@  discard block
 block discarded – undo
86 86
         $this->convert();
87 87
     }
88 88
     
89
-   /**
90
-    * Gets the amount of bytes contained in the size notation.
91
-    * @return int
92
-    */
89
+    /**
90
+     * Gets the amount of bytes contained in the size notation.
91
+     * @return int
92
+     */
93 93
     public function toBytes() : int
94 94
     {
95 95
         return $this->bytes;
96 96
     }
97 97
     
98
-   /**
99
-    * Converts the size notation to a human-readable string, e.g. "50 MB".
100
-    * 
101
-    * @param int $precision
102
-    * @return string
103
-    * @see ConvertHelper::bytes2readable()
104
-    */
98
+    /**
99
+     * Converts the size notation to a human-readable string, e.g. "50 MB".
100
+     * 
101
+     * @param int $precision
102
+     * @return string
103
+     * @see ConvertHelper::bytes2readable()
104
+     */
105 105
     public function toString(int $precision=1) : string
106 106
     {
107 107
         return ConvertHelper::bytes2readable($this->bytes, $precision, $this->getBase());
108 108
     }
109 109
     
110
-   /**
111
-    * Retrieves the detected number's base.
112
-    * @return int The base number (1000 for Base 10, or 1024 for Base 2), or 0 if it is not valid.
113
-    */
110
+    /**
111
+     * Retrieves the detected number's base.
112
+     * @return int The base number (1000 for Base 10, or 1024 for Base 2), or 0 if it is not valid.
113
+     */
114 114
     public function getBase() : int
115 115
     {
116 116
         if($this->isValid()) {
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
         return 0;
121 121
     }
122 122
     
123
-   /**
124
-    * Retrieves the detected storage size instance, if 
125
-    * the size string is valid.
126
-    * 
127
-    * @return ConvertHelper_StorageSizeEnum_Size|NULL
128
-    * @see ConvertHelper_StorageSizeEnum_Size
129
-    */
123
+    /**
124
+     * Retrieves the detected storage size instance, if 
125
+     * the size string is valid.
126
+     * 
127
+     * @return ConvertHelper_StorageSizeEnum_Size|NULL
128
+     * @see ConvertHelper_StorageSizeEnum_Size
129
+     */
130 130
     public function getSizeDefinition() : ?ConvertHelper_StorageSizeEnum_Size
131 131
     {
132 132
         if($this->isValid()) {
@@ -136,27 +136,27 @@  discard block
 block discarded – undo
136 136
         return null;
137 137
     }
138 138
     
139
-   /**
140
-    * Checks whether the size notation was valid and could be parsed
141
-    * into a meaningful byte value. If this returns `false`, it is 
142
-    * possible to use the `getErrorXXX` methods to retrieve information
143
-    * on what went wrong. 
144
-    * 
145
-    * @return bool
146
-    * @see ConvertHelper_SizeNotation::getErrorMessage()
147
-    * @see ConvertHelper_SizeNotation::getErrorCode()
148
-    */
139
+    /**
140
+     * Checks whether the size notation was valid and could be parsed
141
+     * into a meaningful byte value. If this returns `false`, it is 
142
+     * possible to use the `getErrorXXX` methods to retrieve information
143
+     * on what went wrong. 
144
+     * 
145
+     * @return bool
146
+     * @see ConvertHelper_SizeNotation::getErrorMessage()
147
+     * @see ConvertHelper_SizeNotation::getErrorCode()
148
+     */
149 149
     public function isValid() : bool
150 150
     {
151 151
         return $this->valid;
152 152
     }
153 153
     
154
-   /**
155
-    * Retrieves the error message if the size notation validation failed.
156
-    * 
157
-    * @return string
158
-    * @see ConvertHelper_SizeNotation::getErrorCode()
159
-    */
154
+    /**
155
+     * Retrieves the error message if the size notation validation failed.
156
+     * 
157
+     * @return string
158
+     * @see ConvertHelper_SizeNotation::getErrorCode()
159
+     */
160 160
     public function getErrorMessage() : string
161 161
     {
162 162
         return $this->errorMessage;
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
         );
202 202
     }
203 203
     
204
-   /**
205
-    * Detects the units and the number in the size notation string.
206
-    * Populates the `units` and `number` properties.
207
-    * 
208
-    * @return bool Whether the string could be parsed successfully.
209
-    */
204
+    /**
205
+     * Detects the units and the number in the size notation string.
206
+     * Populates the `units` and `number` properties.
207
+     * 
208
+     * @return bool Whether the string could be parsed successfully.
209
+     */
210 210
     protected function detectParts() : bool
211 211
     {
212 212
         $units = ConvertHelper_StorageSizeEnum::getSizeNames();
@@ -242,16 +242,16 @@  discard block
 block discarded – undo
242 242
         return true;
243 243
     }
244 244
     
245
-   /**
246
-    * If the validation fails, this is used to store the reason for retrieval later.
247
-    *  
248
-    * @param string $message
249
-    * @param int $code
250
-    * 
251
-    * @see ConvertHelper_SizeNotation::isValid()
252
-    * @see ConvertHelper_SizeNotation::getErrorMessage()
253
-    * @see ConvertHelper_SizeNotation::getErrorCode()
254
-    */
245
+    /**
246
+     * If the validation fails, this is used to store the reason for retrieval later.
247
+     *  
248
+     * @param string $message
249
+     * @param int $code
250
+     * 
251
+     * @see ConvertHelper_SizeNotation::isValid()
252
+     * @see ConvertHelper_SizeNotation::getErrorMessage()
253
+     * @see ConvertHelper_SizeNotation::getErrorCode()
254
+     */
255 255
     protected function setError(string $message, int $code) : void
256 256
     {
257 257
         $this->valid = false;
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
         $this->errorCode = $code;
260 260
     }
261 261
     
262
-   /**
263
-    * Retrieves the error code, if the size notation validation failed.
264
-    * 
265
-    * @return int
266
-    * @see ConvertHelper_SizeNotation::getErrorMessage()
267
-    */
262
+    /**
263
+     * Retrieves the error code, if the size notation validation failed.
264
+     * 
265
+     * @return int
266
+     * @see ConvertHelper_SizeNotation::getErrorMessage()
267
+     */
268 268
     public function getErrorCode() : int
269 269
     {
270 270
         return $this->errorCode;
Please login to merge, or discard this patch.
src/Request/Param/Validator/Callback.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
         array_unshift($args, $this->value);
35 35
         
36 36
         $result = call_user_func_array($this->getOption('callback'), $args);
37
-        if($result !== false) {
37
+        if ($result !== false) {
38 38
             return $this->value;
39 39
         }
40 40
         
Please login to merge, or discard this patch.
src/VariableInfo/Renderer/HTML.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
             str_replace(' ', '-', $this->type)
41 41
         );
42 42
         
43
-        if($this->info->getBoolOption('prepend-type') && !$this->info->isNull())
43
+        if ($this->info->getBoolOption('prepend-type') && !$this->info->isNull())
44 44
         {
45 45
             $typeLabel = '<span style="color:#1c2eb1" class="variable-type">'.$this->info->getType().'</span> ';
46 46
             $converted = $typeLabel.' '.$converted;
Please login to merge, or discard this patch.
src/XMLHelper/Converter/Decorator.php 3 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -145,8 +145,7 @@  discard block
 block discarded – undo
145 145
                 }
146 146
                 
147 147
                 $this->result[$name][] = $decorator;
148
-            } 
149
-            else 
148
+            } else 
150 149
             {
151 150
                 $this->result[$name] = $decorator;
152 151
             }
@@ -163,8 +162,7 @@  discard block
 block discarded – undo
163 162
             if($this->options['@text']) 
164 163
             {
165 164
                 $this->result['@text'] = $text;
166
-            } 
167
-            else 
165
+            } else 
168 166
             {
169 167
                 $this->result = $text;
170 168
             }
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -28,18 +28,18 @@  discard block
 block discarded – undo
28 28
     
29 29
     public const DEF_DEPTH = 512;
30 30
     
31
-   /**
32
-    * @var array<string,mixed>
33
-    */
31
+    /**
32
+     * @var array<string,mixed>
33
+     */
34 34
     private array $options = array(
35 35
         '@attributes' => true,
36 36
         '@text' => true,
37 37
         'depth' => self::DEF_DEPTH
38 38
     );
39 39
 
40
-   /**
41
-    * @var array<mixed>|string
42
-    */
40
+    /**
41
+     * @var array<mixed>|string
42
+     */
43 43
     protected $result = array();
44 44
     
45 45
     public function __construct(SimpleXMLElement $element)
@@ -47,36 +47,36 @@  discard block
 block discarded – undo
47 47
         $this->subject = $element;
48 48
     }
49 49
     
50
-   /**
51
-    * Whether to use the `@attributes` key to store element attributes.
52
-    * 
53
-    * @param bool $bool
54
-    * @return XMLHelper_Converter_Decorator
55
-    */
50
+    /**
51
+     * Whether to use the `@attributes` key to store element attributes.
52
+     * 
53
+     * @param bool $bool
54
+     * @return XMLHelper_Converter_Decorator
55
+     */
56 56
     public function useAttributes(bool $bool) : XMLHelper_Converter_Decorator 
57 57
     {
58 58
         $this->options['@attributes'] = $bool;
59 59
         return $this;
60 60
     }
61 61
     
62
-   /**
63
-    * Whether to use the `@text` key to store the node text.
64
-    * 
65
-    * @param bool $bool
66
-    * @return XMLHelper_Converter_Decorator
67
-    */
62
+    /**
63
+     * Whether to use the `@text` key to store the node text.
64
+     * 
65
+     * @param bool $bool
66
+     * @return XMLHelper_Converter_Decorator
67
+     */
68 68
     public function useText(bool $bool) : XMLHelper_Converter_Decorator 
69 69
     {
70 70
         $this->options['@text'] = $bool;
71 71
         return $this;
72 72
     }
73 73
     
74
-   /**
75
-    * Set the maximum depth to parse in the document.
76
-    * 
77
-    * @param int $depth
78
-    * @return XMLHelper_Converter_Decorator
79
-    */
74
+    /**
75
+     * Set the maximum depth to parse in the document.
76
+     * 
77
+     * @param int $depth
78
+     * @return XMLHelper_Converter_Decorator
79
+     */
80 80
     public function setDepth(int $depth) : XMLHelper_Converter_Decorator 
81 81
     {
82 82
         $this->options['depth'] = (int)max(0, $depth);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $this->traverseChildren();
97 97
         $this->encodeTextElements();
98 98
 
99
-        if(is_array($this->result) && !empty($this->result))
99
+        if (is_array($this->result) && !empty($this->result))
100 100
         {
101 101
             return $this->result;
102 102
         }
@@ -107,20 +107,20 @@  discard block
 block discarded – undo
107 107
     
108 108
     protected function detectAttributes() : void
109 109
     {
110
-        if(!$this->options['@attributes']) {
110
+        if (!$this->options['@attributes']) {
111 111
             return;
112 112
         }
113 113
         
114 114
         $attributes = $this->subject->attributes();
115 115
         
116
-        if($attributes === null)
116
+        if ($attributes === null)
117 117
         {
118 118
             return;
119 119
         }
120 120
 
121 121
         $values = array_map('strval', iterator_to_array($attributes));
122 122
 
123
-        if(!empty($values))
123
+        if (!empty($values))
124 124
         {
125 125
             $this->result['@attributes'] = $values;
126 126
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         $children = $this->subject;
132 132
         $depth = $this->options['depth'] - 1;
133 133
         
134
-        if($depth <= 0) 
134
+        if ($depth <= 0) 
135 135
         {
136 136
             $children = [];
137 137
         }
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
             
145 145
             $decorator->options = ['depth' => $depth] + $this->options;
146 146
 
147
-            if(isset($this->result[$name]))
147
+            if (isset($this->result[$name]))
148 148
             {
149
-                if(!is_array($this->result[$name])) 
149
+                if (!is_array($this->result[$name])) 
150 150
                 {
151 151
                     $this->result[$name] = array($this->result[$name]);
152 152
                 }
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
         // json encode non-whitespace element simplexml text values.
166 166
         $text = trim((string)$this->subject);
167 167
         
168
-        if($text !== '')
168
+        if ($text !== '')
169 169
         {
170
-            if($this->options['@text']) 
170
+            if ($this->options['@text']) 
171 171
             {
172 172
                 $this->result['@text'] = $text;
173 173
             } 
Please login to merge, or discard this patch.
src/RequestHelper/Response.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@
 block discarded – undo
142 142
     
143 143
     protected function getInfoKey(string $name) : string
144 144
     {
145
-        if(isset($this->info[$name])) {
145
+        if (isset($this->info[$name])) {
146 146
             return (string)$this->info[$name];
147 147
         }
148 148
         
Please login to merge, or discard this patch.
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -31,21 +31,21 @@  discard block
 block discarded – undo
31 31
     protected array $info;
32 32
     
33 33
 
34
-   /**
35
-    * @param RequestHelper $helper
36
-    * @param array<string,mixed> $info The CURL info array from curl_getinfo().
37
-    */
34
+    /**
35
+     * @param RequestHelper $helper
36
+     * @param array<string,mixed> $info The CURL info array from curl_getinfo().
37
+     */
38 38
     public function __construct(RequestHelper $helper, array $info)
39 39
     {
40 40
         $this->request = $helper;
41 41
         $this->info = $info;
42 42
     }
43 43
     
44
-   /**
45
-    * Retrieves the request instance that initiated the request.
46
-    *  
47
-    * @return RequestHelper
48
-    */
44
+    /**
45
+     * Retrieves the request instance that initiated the request.
46
+     *  
47
+     * @return RequestHelper
48
+     */
49 49
     public function getRequest() : RequestHelper
50 50
     {
51 51
         return $this->request;
@@ -66,79 +66,79 @@  discard block
 block discarded – undo
66 66
         return $this;
67 67
     }
68 68
     
69
-   /**
70
-    * Whether an error occurred in the request.
71
-    * @return bool
72
-    */
69
+    /**
70
+     * Whether an error occurred in the request.
71
+     * @return bool
72
+     */
73 73
     public function isError() : bool
74 74
     {
75 75
         return $this->isError;
76 76
     }
77 77
     
78
-   /**
79
-    * Whether the request timed out.
80
-    * @return bool
81
-    */
78
+    /**
79
+     * Whether the request timed out.
80
+     * @return bool
81
+     */
82 82
     public function isTimeout() : bool
83 83
     {
84 84
         return $this->errorCode === RequestHelper_CURL::OPERATION_TIMEDOUT;
85 85
     }
86 86
     
87
-   /**
88
-    * Retrieves the native error message, if an error occurred.
89
-    * @return string
90
-    */
87
+    /**
88
+     * Retrieves the native error message, if an error occurred.
89
+     * @return string
90
+     */
91 91
     public function getErrorMessage() : string
92 92
     {
93 93
         return $this->errorMessage;
94 94
     }
95 95
     
96
-   /**
97
-    * Retrieves the native CURL error code, if an error occurred.
98
-    * @return int
99
-    * @see RequestHelper_CURL For a list of error codes.
100
-    */
96
+    /**
97
+     * Retrieves the native CURL error code, if an error occurred.
98
+     * @return int
99
+     * @see RequestHelper_CURL For a list of error codes.
100
+     */
101 101
     public function getErrorCode() : int
102 102
     {
103 103
         return $this->errorCode;
104 104
     }
105 105
     
106
-   /**
107
-    * Retrieves the full body of the request.
108
-    * 
109
-    * @return string
110
-    */
106
+    /**
107
+     * Retrieves the full body of the request.
108
+     * 
109
+     * @return string
110
+     */
111 111
     public function getRequestBody() : string
112 112
     {
113 113
         return $this->request->getBody();
114 114
     }
115 115
     
116
-   /**
117
-    * Retrieves the body of the response, if any.
118
-    * 
119
-    * @return string
120
-    */
116
+    /**
117
+     * Retrieves the body of the response, if any.
118
+     * 
119
+     * @return string
120
+     */
121 121
     public function getResponseBody() : string
122 122
     {
123 123
         return $this->body;
124 124
     }
125 125
     
126
-   /**
127
-    * The response HTTP code.
128
-    * 
129
-    * @return int The code, or 0 if none was sent (on error).
130
-    */
126
+    /**
127
+     * The response HTTP code.
128
+     * 
129
+     * @return int The code, or 0 if none was sent (on error).
130
+     */
131 131
     public function getCode() : int
132 132
     {
133 133
         return (int)$this->getInfoKey('http_code');
134 134
     }
135 135
     
136
-   /**
137
-    * Retrieves the actual headers that were sent in the request:
138
-    * one header by entry in the indexed array.
139
-    * 
140
-    * @return string[]
141
-    */
136
+    /**
137
+     * Retrieves the actual headers that were sent in the request:
138
+     * one header by entry in the indexed array.
139
+     * 
140
+     * @return string[]
141
+     */
142 142
     public function getHeaders() : array
143 143
     {
144 144
         return ConvertHelper::explodeTrim("\n", $this->getInfoKey('request_header'));
Please login to merge, or discard this patch.
src/ConvertHelper/StorageSizeEnum.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     */
45 45
     protected static function init() : void
46 46
     {
47
-        if(!empty(self::$sizes)) {
47
+        if (!empty(self::$sizes)) {
48 48
             return;
49 49
         }
50 50
         
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         
63 63
         self::addSize('b', 1, 1, t('B'), t('Byte'), t('Bytes'));
64 64
         
65
-        if(class_exists('AppLocalize\Localization')) 
65
+        if (class_exists('AppLocalize\Localization')) 
66 66
         {
67 67
             \AppLocalize\Localization::onLocaleChanged(array(self::class, 'handle_localeChanged'));
68 68
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         
132 132
         $name = strtolower($name);
133 133
         
134
-        if(isset(self::$sizes[$name])) {
134
+        if (isset(self::$sizes[$name])) {
135 135
             return self::$sizes[$name];
136 136
         }
137 137
         
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
         
174 174
         $result = array();
175 175
         
176
-        foreach(self::$sizes as $size)
176
+        foreach (self::$sizes as $size)
177 177
         {
178
-            if($size->getBase() === $base) {
178
+            if ($size->getBase() === $base) {
179 179
                 $result[] = $size;
180 180
             }
181 181
         }
Please login to merge, or discard this patch.
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -30,17 +30,17 @@  discard block
 block discarded – undo
30 30
     public const BASE_10 = 1000;
31 31
     public const BASE_2 = 1024;
32 32
     
33
-   /**
34
-    * @var array<string,ConvertHelper_StorageSizeEnum_Size>
35
-    */
33
+    /**
34
+     * @var array<string,ConvertHelper_StorageSizeEnum_Size>
35
+     */
36 36
     protected static $sizes = array();
37 37
     
38
-   /**
39
-    * Initializes the supported unit notations, and
40
-    * how they are supposed to be calculated.
41
-    *
42
-    * @see ConvertHelper_SizeNotation::parseSize()
43
-    */
38
+    /**
39
+     * Initializes the supported unit notations, and
40
+     * how they are supposed to be calculated.
41
+     *
42
+     * @see ConvertHelper_SizeNotation::parseSize()
43
+     */
44 44
     protected static function init() : void
45 45
     {
46 46
         if(!empty(self::$sizes)) {
@@ -67,28 +67,28 @@  discard block
 block discarded – undo
67 67
         }
68 68
     }
69 69
     
70
-   /**
71
-    * Called whenever the application locale is changed,
72
-    * to reset the size definitions so the labels get 
73
-    * translated to the new locale.
74
-    */
70
+    /**
71
+     * Called whenever the application locale is changed,
72
+     * to reset the size definitions so the labels get 
73
+     * translated to the new locale.
74
+     */
75 75
     public static function handle_localeChanged() : void
76 76
     {
77 77
         self::$sizes = array();
78 78
     }
79 79
     
80
-   /**
81
-    * Adds a storage size to the internal collection.
82
-    * 
83
-    * @param string $name The lowercase size name, e.g. "kb", "mib"
84
-    * @param int $base This defines how many bytes there are in a kilobyte, to differentiate with the two common way to calculate sizes: base 10 or base 2. See the Wikipedia link for more details.
85
-    * @param int $exponent The multiplier of the base to get the byte value
86
-    * @param string $suffix The localized short suffix, e.g. "KB", "MiB"
87
-    * @param string $singular The localized singular label of the size, e.g. "Kilobyte".
88
-    * @param string $plural The localized plural label of the size, e.g. "Kilobytes".
89
-    * 
90
-    * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions
91
-    */
80
+    /**
81
+     * Adds a storage size to the internal collection.
82
+     * 
83
+     * @param string $name The lowercase size name, e.g. "kb", "mib"
84
+     * @param int $base This defines how many bytes there are in a kilobyte, to differentiate with the two common way to calculate sizes: base 10 or base 2. See the Wikipedia link for more details.
85
+     * @param int $exponent The multiplier of the base to get the byte value
86
+     * @param string $suffix The localized short suffix, e.g. "KB", "MiB"
87
+     * @param string $singular The localized singular label of the size, e.g. "Kilobyte".
88
+     * @param string $plural The localized plural label of the size, e.g. "Kilobytes".
89
+     * 
90
+     * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions
91
+     */
92 92
     protected static function addSize(string $name, int $base, int $exponent, string $suffix, string $singular, string $plural) : void
93 93
     {
94 94
         self::$sizes[$name] = new ConvertHelper_StorageSizeEnum_Size(
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
         );
102 102
     }
103 103
     
104
-   /**
105
-    * Retrieves all known sizes.
106
-    * 
107
-    * @return ConvertHelper_StorageSizeEnum_Size[]
108
-    */
104
+    /**
105
+     * Retrieves all known sizes.
106
+     * 
107
+     * @return ConvertHelper_StorageSizeEnum_Size[]
108
+     */
109 109
     public static function getSizes() : array
110 110
     {
111 111
         self::init();
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
         return array_values(self::$sizes);
114 114
     }
115 115
     
116
-   /**
117
-    * Retrieves a size definition instance by its name.
118
-    * 
119
-    * @param string $name Case-insensitive. For example "kb", "MiB"...
120
-    * @throws ConvertHelper_Exception
121
-    * @return ConvertHelper_StorageSizeEnum_Size
122
-    * 
123
-    * @see ConvertHelper_StorageSizeEnum::ERROR_UNKNOWN_UNIT_NAME
124
-    */
116
+    /**
117
+     * Retrieves a size definition instance by its name.
118
+     * 
119
+     * @param string $name Case-insensitive. For example "kb", "MiB"...
120
+     * @throws ConvertHelper_Exception
121
+     * @return ConvertHelper_StorageSizeEnum_Size
122
+     * 
123
+     * @see ConvertHelper_StorageSizeEnum::ERROR_UNKNOWN_UNIT_NAME
124
+     */
125 125
     public static function getSizeByName(string $name) : ConvertHelper_StorageSizeEnum_Size
126 126
     {
127 127
         self::init();
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
         );
144 144
     }
145 145
     
146
-   /**
147
-    * Retrieves a list of all size names, e.g. "mb", "kib" (lowercase).
148
-    * @return string[]
149
-    */
146
+    /**
147
+     * Retrieves a list of all size names, e.g. "mb", "kib" (lowercase).
148
+     * @return string[]
149
+     */
150 150
     public static function getSizeNames() : array
151 151
     {
152 152
         self::init();
@@ -154,16 +154,16 @@  discard block
 block discarded – undo
154 154
         return array_keys(self::$sizes);
155 155
     }
156 156
    
157
-   /**
158
-    * Retrieves all available storage sizes for the specified
159
-    * base value.
160
-    * 
161
-    * @param int $base
162
-    * @return ConvertHelper_StorageSizeEnum_Size[]
163
-    * 
164
-    * @see ConvertHelper_StorageSizeEnum::BASE_10
165
-    * @see ConvertHelper_StorageSizeEnum::BASE_2
166
-    */
157
+    /**
158
+     * Retrieves all available storage sizes for the specified
159
+     * base value.
160
+     * 
161
+     * @param int $base
162
+     * @return ConvertHelper_StorageSizeEnum_Size[]
163
+     * 
164
+     * @see ConvertHelper_StorageSizeEnum::BASE_10
165
+     * @see ConvertHelper_StorageSizeEnum::BASE_2
166
+     */
167 167
     public static function getSizesByBase(int $base) : array
168 168
     {
169 169
         self::init();
Please login to merge, or discard this patch.
src/ConvertHelper/TabsNormalizer.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     * @param bool $enable
58 58
     * @return ConvertHelper_TabsNormalizer
59 59
     */
60
-    public function convertTabsToSpaces(bool $enable=true) : ConvertHelper_TabsNormalizer
60
+    public function convertTabsToSpaces(bool $enable = true) : ConvertHelper_TabsNormalizer
61 61
     {
62 62
         $this->tabs2spaces = $enable;
63 63
         
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         
95 95
         $result = $this->_normalize();
96 96
         
97
-        if($this->tabs2spaces) 
97
+        if ($this->tabs2spaces) 
98 98
         {
99 99
             $result = ConvertHelper::tabs2spaces($result, $this->tabSize);
100 100
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     {
109 109
         $eol = ConvertHelper::detectEOLCharacter($string);
110 110
         
111
-        if($eol !== null) 
111
+        if ($eol !== null) 
112 112
         {
113 113
             $this->eol = $eol->getCharacter();
114 114
         }
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
     {
127 127
         $converted = array();
128 128
         
129
-        foreach($this->lines as $line) 
129
+        foreach ($this->lines as $line) 
130 130
         {
131 131
             $amount = substr_count($line, "\t") - $this->min;
132 132
             
133 133
             $line = trim($line, "\n\r\t");
134 134
             
135
-            if($amount >= 1) 
135
+            if ($amount >= 1) 
136 136
             {
137
-                $line = str_repeat("\t", $amount) . $line;
137
+                $line = str_repeat("\t", $amount).$line;
138 138
             }
139 139
             
140 140
             $converted[] = $line;
@@ -149,23 +149,23 @@  discard block
 block discarded – undo
149 149
     */
150 150
     protected function countOccurrences() : void
151 151
     {
152
-        foreach($this->lines as $line) 
152
+        foreach ($this->lines as $line) 
153 153
         {
154 154
             $amount = substr_count($line, "\t");
155 155
             
156
-            if($amount > $this->max) 
156
+            if ($amount > $this->max) 
157 157
             {
158 158
                 $this->max = $amount;
159 159
                 continue;
160 160
             }
161 161
             
162
-            if($amount > 0 && $amount < $this->min) 
162
+            if ($amount > 0 && $amount < $this->min) 
163 163
             {
164 164
                 $this->min = $amount;
165 165
             }
166 166
         }
167 167
         
168
-        if($this->min === PHP_INT_MAX) {
168
+        if ($this->min === PHP_INT_MAX) {
169 169
             $this->min = 0;
170 170
         }
171 171
     }
Please login to merge, or discard this patch.
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -20,43 +20,43 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class ConvertHelper_TabsNormalizer
22 22
 {
23
-   /**
24
-    * @var integer
25
-    */
23
+    /**
24
+     * @var integer
25
+     */
26 26
     protected $max = 0;
27 27
     
28
-   /**
29
-    * @var integer
30
-    */
28
+    /**
29
+     * @var integer
30
+     */
31 31
     protected $min = PHP_INT_MAX;
32 32
     
33
-   /**
34
-    * @var bool
35
-    */
33
+    /**
34
+     * @var bool
35
+     */
36 36
     protected $tabs2spaces = false;
37 37
     
38
-   /**
39
-    * @var string[]
40
-    */
38
+    /**
39
+     * @var string[]
40
+     */
41 41
     protected $lines = array();
42 42
 
43
-   /**
44
-    * @var string
45
-    */
43
+    /**
44
+     * @var string
45
+     */
46 46
     protected $eol = '';
47 47
     
48
-   /**
49
-    * @var integer
50
-    */
48
+    /**
49
+     * @var integer
50
+     */
51 51
     protected $tabSize = 4;
52 52
     
53
-   /**
54
-    * Whether to enable or disable the conversion
55
-    * of tabs to spaces.
56
-    * 
57
-    * @param bool $enable
58
-    * @return ConvertHelper_TabsNormalizer
59
-    */
53
+    /**
54
+     * Whether to enable or disable the conversion
55
+     * of tabs to spaces.
56
+     * 
57
+     * @param bool $enable
58
+     * @return ConvertHelper_TabsNormalizer
59
+     */
60 60
     public function convertTabsToSpaces(bool $enable=true) : ConvertHelper_TabsNormalizer
61 61
     {
62 62
         $this->tabs2spaces = $enable;
@@ -64,13 +64,13 @@  discard block
 block discarded – undo
64 64
         return $this;
65 65
     }
66 66
     
67
-   /**
68
-    * Sets the size of a tab, in spaces. Used to convert tabs
69
-    * from spaces and the other way around. Defaults to 4.
70
-    * 
71
-    * @param int $amountSpaces
72
-    * @return ConvertHelper_TabsNormalizer
73
-    */
67
+    /**
68
+     * Sets the size of a tab, in spaces. Used to convert tabs
69
+     * from spaces and the other way around. Defaults to 4.
70
+     * 
71
+     * @param int $amountSpaces
72
+     * @return ConvertHelper_TabsNormalizer
73
+     */
74 74
     public function setTabSize(int $amountSpaces) : ConvertHelper_TabsNormalizer
75 75
     {
76 76
         $this->tabSize = $amountSpaces;
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
         return $this;
79 79
     }
80 80
     
81
-   /**
82
-    * Normalizes tabs in the specified string by indenting everything
83
-    * back to the minimum tab distance. With the second parameter,
84
-    * tabs can optionally be converted to spaces as well (recommended
85
-    * for HTML output).
86
-    *
87
-    * @param string $string
88
-    * @return string
89
-    */
81
+    /**
82
+     * Normalizes tabs in the specified string by indenting everything
83
+     * back to the minimum tab distance. With the second parameter,
84
+     * tabs can optionally be converted to spaces as well (recommended
85
+     * for HTML output).
86
+     *
87
+     * @param string $string
88
+     * @return string
89
+     */
90 90
     public function normalize(string $string) : string
91 91
     {
92 92
         $this->splitLines($string);
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
         return implode($this->eol, $converted);
144 144
     }
145 145
     
146
-   /**
147
-    * Finds out the minimum and maximum amount of 
148
-    * tabs in the string.
149
-    */
146
+    /**
147
+     * Finds out the minimum and maximum amount of 
148
+     * tabs in the string.
149
+     */
150 150
     protected function countOccurrences() : void
151 151
     {
152 152
         foreach($this->lines as $line) 
Please login to merge, or discard this patch.
src/ConvertHelper/HiddenConverter.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     */
94 94
     public function selectCharacters(string $type) : ConvertHelper_HiddenConverter
95 95
     {
96
-        if(!in_array($type, $this->selected)) {
96
+        if (!in_array($type, $this->selected)) {
97 97
             $this->selected[] = $type;
98 98
         }
99 99
         
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     {
110 110
         $selected = $this->selected;
111 111
         
112
-        if(empty($this->selected)) 
112
+        if (empty($this->selected)) 
113 113
         {
114 114
             $selected = array(
115 115
                 self::CHARS_WHITESPACE,
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
         
120 120
         $result = array();
121 121
         
122
-        foreach($selected as $type) 
122
+        foreach ($selected as $type) 
123 123
         {
124
-            if(isset($this->characters[$type])) 
124
+            if (isset($this->characters[$type])) 
125 125
             {
126 126
                 $result = array_merge($result, $this->characters[$type]);
127 127
             }
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
         )
72 72
     );
73 73
     
74
-   /**
75
-    * @var string[]
76
-    */
74
+    /**
75
+     * @var string[]
76
+     */
77 77
     protected $selected = array();
78 78
     
79 79
     public function convert(string $string) : string
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
         return str_replace(array_keys($chars), array_values($chars), $string);
84 84
     }
85 85
     
86
-   /**
87
-    * Selects a character set to replace. Can be called
88
-    * several times to add additional sets to the collection.
89
-    * 
90
-    * @param string $type See the <code>CHAR_XXX</code> constants.
91
-    * @return ConvertHelper_HiddenConverter
92
-    * 
93
-    * @see ConvertHelper_HiddenConverter::CHARS_CONTROL
94
-    * @see ConvertHelper_HiddenConverter::CHARS_WHITESPACE
95
-    */
86
+    /**
87
+     * Selects a character set to replace. Can be called
88
+     * several times to add additional sets to the collection.
89
+     * 
90
+     * @param string $type See the <code>CHAR_XXX</code> constants.
91
+     * @return ConvertHelper_HiddenConverter
92
+     * 
93
+     * @see ConvertHelper_HiddenConverter::CHARS_CONTROL
94
+     * @see ConvertHelper_HiddenConverter::CHARS_WHITESPACE
95
+     */
96 96
     public function selectCharacters(string $type) : ConvertHelper_HiddenConverter
97 97
     {
98 98
         if(!in_array($type, $this->selected)) {
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
         return $this;
103 103
     }
104 104
     
105
-   /**
106
-    * Resolves the list of characters to make visible.
107
-    * 
108
-    * @return string[]
109
-    */
105
+    /**
106
+     * Resolves the list of characters to make visible.
107
+     * 
108
+     * @return string[]
109
+     */
110 110
     protected function resolveSelection() : array
111 111
     {
112 112
         $selected = $this->selected;
Please login to merge, or discard this patch.