Test Failed
Push — master ( fdf3d2...9d70d1 )
by Sebastian
04:37
created
src/Request/Param/Validator/Enum.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     
30 30
     protected function _validate()
31 31
     {
32
-        if(in_array($this->value, $this->getArrayOption('values'))) {
32
+        if (in_array($this->value, $this->getArrayOption('values'))) {
33 33
             return $this->value;
34 34
         }
35 35
         
Please login to merge, or discard this patch.
src/VariableInfo/Renderer/String.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 block discarded – undo
6 6
 
7 7
 abstract class VariableInfo_Renderer_String extends VariableInfo_Renderer
8 8
 {
9
-   /**
10
-    * @var mixed
11
-    */
9
+    /**
10
+     * @var mixed
11
+     */
12 12
     protected $value;
13 13
     
14 14
     protected function init()
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/VariableInfo/Renderer.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,19 +6,19 @@  discard block
 block discarded – undo
6 6
 
7 7
 abstract class VariableInfo_Renderer
8 8
 {
9
-   /**
10
-    * @var mixed
11
-    */
9
+    /**
10
+     * @var mixed
11
+     */
12 12
     protected $value;
13 13
     
14
-   /**
15
-    * @var VariableInfo
16
-    */
14
+    /**
15
+     * @var VariableInfo
16
+     */
17 17
     protected $info;
18 18
     
19
-   /**
20
-    * @var string
21
-    */
19
+    /**
20
+     * @var string
21
+     */
22 22
     protected $type;
23 23
     
24 24
     public function __construct(VariableInfo $info)
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
     
32 32
     abstract protected function init();
33 33
 
34
-   /**
35
-    * Renders the value to the target format.
36
-    * 
37
-    * @return mixed
38
-    */
34
+    /**
35
+     * Renders the value to the target format.
36
+     * 
37
+     * @return mixed
38
+     */
39 39
     public function render()
40 40
     {
41 41
         return $this->_render();
Please login to merge, or discard this patch.
src/XMLHelper/Converter/Decorator.php 3 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
     
108 108
     protected function detectAttributes()
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(!empty($attributes)) 
116
+        if (!empty($attributes)) 
117 117
         {
118 118
             $this->result['@attributes'] = array_map('strval', iterator_to_array($attributes));
119 119
         }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $children = $this->subject;
125 125
         $depth = $this->options['depth'] - 1;
126 126
         
127
-        if($depth <= 0) 
127
+        if ($depth <= 0) 
128 128
         {
129 129
             $children = [];
130 130
         }
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
             
138 138
             $decorator->options = ['depth' => $depth] + $this->options;
139 139
             
140
-            if(isset($this->result[$name])) 
140
+            if (isset($this->result[$name])) 
141 141
             {
142
-                if(!is_array($this->result[$name])) 
142
+                if (!is_array($this->result[$name])) 
143 143
                 {
144 144
                     $this->result[$name] = [$this->result[$name]];
145 145
                 }
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
         // json encode non-whitespace element simplexml text values.
159 159
         $text = trim((string)$this->subject);
160 160
         
161
-        if(strlen($text)) 
161
+        if (strlen($text)) 
162 162
         {
163
-            if($this->options['@text']) 
163
+            if ($this->options['@text']) 
164 164
             {
165 165
                 $this->result['@text'] = $text;
166 166
             } 
Please login to merge, or discard this patch.
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   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -21,25 +21,25 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class XMLHelper_Converter_Decorator implements \JsonSerializable
23 23
 {
24
-   /**
25
-    * @var \SimpleXMLElement
26
-    */
24
+    /**
25
+     * @var \SimpleXMLElement
26
+     */
27 27
     private $subject;
28 28
     
29 29
     public const DEF_DEPTH = 512;
30 30
     
31
-   /**
32
-    * @var array
33
-    */
31
+    /**
32
+     * @var array
33
+     */
34 34
     private $options = array(
35 35
         '@attributes' => true,
36 36
         '@text' => true,
37 37
         'depth' => self::DEF_DEPTH
38 38
     );
39 39
 
40
-   /**
41
-    * @var array|string|null
42
-    */
40
+    /**
41
+     * @var array|string|null
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)$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)$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.
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   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -19,51 +19,51 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class RequestHelper_Response
21 21
 {
22
-   /**
23
-    * @var RequestHelper
24
-    */
22
+    /**
23
+     * @var RequestHelper
24
+     */
25 25
     protected $request;
26 26
     
27
-   /**
28
-    * @var string
29
-    */
27
+    /**
28
+     * @var string
29
+     */
30 30
     protected $body = '';
31 31
     
32
-   /**
33
-    * @var array
34
-    */
32
+    /**
33
+     * @var array
34
+     */
35 35
     protected $info;
36 36
     
37
-   /**
38
-    * @var bool
39
-    */
37
+    /**
38
+     * @var bool
39
+     */
40 40
     protected $isError = false;
41 41
     
42
-   /**
43
-    * @var string
44
-    */
42
+    /**
43
+     * @var string
44
+     */
45 45
     protected $errorMessage = '';
46 46
     
47
-   /**
48
-    * @var integer
49
-    */
47
+    /**
48
+     * @var integer
49
+     */
50 50
     protected $errorCode = 0;
51 51
     
52
-   /**
53
-    * @param RequestHelper $helper
54
-    * @param array $info The CURL info array from curl_getinfo().
55
-    */
52
+    /**
53
+     * @param RequestHelper $helper
54
+     * @param array $info The CURL info array from curl_getinfo().
55
+     */
56 56
     public function __construct(RequestHelper $helper, array $info)
57 57
     {
58 58
         $this->request = $helper;
59 59
         $this->info = $info;
60 60
     }
61 61
     
62
-   /**
63
-    * Retrieves the request instance that initiated the request.
64
-    *  
65
-    * @return RequestHelper
66
-    */
62
+    /**
63
+     * Retrieves the request instance that initiated the request.
64
+     *  
65
+     * @return RequestHelper
66
+     */
67 67
     public function getRequest() : RequestHelper
68 68
     {
69 69
         return $this->request;
@@ -84,79 +84,79 @@  discard block
 block discarded – undo
84 84
         return $this;
85 85
     }
86 86
     
87
-   /**
88
-    * Whether an error occurred in the request.
89
-    * @return bool
90
-    */
87
+    /**
88
+     * Whether an error occurred in the request.
89
+     * @return bool
90
+     */
91 91
     public function isError() : bool
92 92
     {
93 93
         return $this->isError;
94 94
     }
95 95
     
96
-   /**
97
-    * Whether the request timed out.
98
-    * @return bool
99
-    */
96
+    /**
97
+     * Whether the request timed out.
98
+     * @return bool
99
+     */
100 100
     public function isTimeout() : bool
101 101
     {
102 102
         return $this->errorCode === RequestHelper_CURL::OPERATION_TIMEDOUT;
103 103
     }
104 104
     
105
-   /**
106
-    * Retrieves the native error message, if an error occurred.
107
-    * @return string
108
-    */
105
+    /**
106
+     * Retrieves the native error message, if an error occurred.
107
+     * @return string
108
+     */
109 109
     public function getErrorMessage() : string
110 110
     {
111 111
         return $this->errorMessage;
112 112
     }
113 113
     
114
-   /**
115
-    * Retrieves the native CURL error code, if an error occurred.
116
-    * @return int
117
-    * @see RequestHelper_CURL For a list of error codes.
118
-    */
114
+    /**
115
+     * Retrieves the native CURL error code, if an error occurred.
116
+     * @return int
117
+     * @see RequestHelper_CURL For a list of error codes.
118
+     */
119 119
     public function getErrorCode() : int
120 120
     {
121 121
         return $this->errorCode;
122 122
     }
123 123
     
124
-   /**
125
-    * Retrieves the full body of the request.
126
-    * 
127
-    * @return string
128
-    */
124
+    /**
125
+     * Retrieves the full body of the request.
126
+     * 
127
+     * @return string
128
+     */
129 129
     public function getRequestBody() : string
130 130
     {
131 131
         return $this->request->getBody();
132 132
     }
133 133
     
134
-   /**
135
-    * Retrieves the body of the response, if any.
136
-    * 
137
-    * @return string
138
-    */
134
+    /**
135
+     * Retrieves the body of the response, if any.
136
+     * 
137
+     * @return string
138
+     */
139 139
     public function getResponseBody() : string
140 140
     {
141 141
         return $this->body;
142 142
     }
143 143
     
144
-   /**
145
-    * The response HTTP code.
146
-    * 
147
-    * @return int The code, or 0 if none was sent (on error).
148
-    */
144
+    /**
145
+     * The response HTTP code.
146
+     * 
147
+     * @return int The code, or 0 if none was sent (on error).
148
+     */
149 149
     public function getCode() : int
150 150
     {
151 151
         return intval($this->getInfoKey('http_code'));
152 152
     }
153 153
     
154
-   /**
155
-    * Retrieves the actual headers that were sent in the request:
156
-    * one header by entry in the indexed array.
157
-    * 
158
-    * @return array
159
-    */
154
+    /**
155
+     * Retrieves the actual headers that were sent in the request:
156
+     * one header by entry in the indexed array.
157
+     * 
158
+     * @return array
159
+     */
160 160
     public function getHeaders() : array
161 161
     {
162 162
         return ConvertHelper::explodeTrim("\n", $this->getInfoKey('request_header'));
Please login to merge, or discard this patch.
src/URLInfo/Normalizer.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -32,23 +32,23 @@
 block discarded – undo
32 32
         $this->info = $info;
33 33
     }
34 34
     
35
-   /**
36
-    * Enables the authentication information in the URL,
37
-    * if a username and password are present.
38
-    * 
39
-    * @param bool $enable Whether to turn it on or off.
40
-    * @return URLInfo_Normalizer
41
-    */
35
+    /**
36
+     * Enables the authentication information in the URL,
37
+     * if a username and password are present.
38
+     * 
39
+     * @param bool $enable Whether to turn it on or off.
40
+     * @return URLInfo_Normalizer
41
+     */
42 42
     public function enableAuth(bool $enable=true) : URLInfo_Normalizer
43 43
     {
44 44
         $this->auth = $enable;
45 45
         return $this;
46 46
     }
47 47
     
48
-   /**
49
-    * Retrieves the normalized URL.
50
-    * @return string
51
-    */
48
+    /**
49
+     * Retrieves the normalized URL.
50
+     * @return string
51
+     */
52 52
     public function normalize() : string
53 53
     {
54 54
         $method = 'normalize_'.$this->info->getType();
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     * @param bool $enable Whether to turn it on or off.
40 40
     * @return URLInfo_Normalizer
41 41
     */
42
-    public function enableAuth(bool $enable=true) : URLInfo_Normalizer
42
+    public function enableAuth(bool $enable = true) : URLInfo_Normalizer
43 43
     {
44 44
         $this->auth = $enable;
45 45
         return $this;
@@ -86,48 +86,48 @@  discard block
 block discarded – undo
86 86
     
87 87
     protected function renderAuth(string $normalized) : string
88 88
     {
89
-        if(!$this->info->hasUsername() || !$this->auth) {
89
+        if (!$this->info->hasUsername() || !$this->auth) {
90 90
             return $normalized;
91 91
         }
92 92
          
93
-        return $normalized . urlencode($this->info->getUsername()).':'.urlencode($this->info->getPassword()).'@';
93
+        return $normalized.urlencode($this->info->getUsername()).':'.urlencode($this->info->getPassword()).'@';
94 94
     }
95 95
     
96 96
     protected function renderPort(string $normalized) : string
97 97
     {
98
-        if(!$this->info->hasPort()) {
98
+        if (!$this->info->hasPort()) {
99 99
             return $normalized;
100 100
         }
101 101
         
102
-        return $normalized . ':'.$this->info->getPort();
102
+        return $normalized.':'.$this->info->getPort();
103 103
     }
104 104
     
105 105
     protected function renderPath(string $normalized) : string
106 106
     {
107
-        if(!$this->info->hasPath()) {
107
+        if (!$this->info->hasPath()) {
108 108
             return $normalized; 
109 109
         }
110 110
         
111
-        return $normalized . $this->info->getPath();
111
+        return $normalized.$this->info->getPath();
112 112
     }
113 113
     
114 114
     protected function renderParams(string $normalized) : string
115 115
     {
116 116
         $params = $this->info->getParams();
117 117
         
118
-        if(empty($params)) {
118
+        if (empty($params)) {
119 119
             return $normalized;
120 120
         }
121 121
         
122
-        return $normalized . '?'.http_build_query($params, '', '&', PHP_QUERY_RFC3986);
122
+        return $normalized.'?'.http_build_query($params, '', '&', PHP_QUERY_RFC3986);
123 123
     }
124 124
     
125 125
     protected function renderFragment(string $normalized) : string
126 126
     {
127
-        if(!$this->info->hasFragment()) {
127
+        if (!$this->info->hasFragment()) {
128 128
             return $normalized;
129 129
         }
130 130
         
131
-        return $normalized . '#'.$this->info->getFragment();
131
+        return $normalized.'#'.$this->info->getFragment();
132 132
     }
133 133
 }
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.