Passed
Push — master ( 6080f3...d98100 )
by Sebastian
03:12
created
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/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.
src/Request/Param/Validator/Array.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@
 block discarded – undo
28 28
     protected function _validate()
29 29
     {
30 30
         // subvalues cannot be arrays
31
-        if($this->isSubvalue) {
31
+        if ($this->isSubvalue) {
32 32
             return $this->value;
33 33
         }
34 34
         
35
-        if(is_array($this->value)) {
35
+        if (is_array($this->value)) {
36 36
             return $this->value;
37 37
         }
38 38
         
Please login to merge, or discard this patch.
src/RequestHelper/Boundaries/Boundary.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -19,34 +19,34 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class RequestHelper_Boundaries_Boundary
21 21
 {
22
-   /**
23
-    * @var string
24
-    */
22
+    /**
23
+     * @var string
24
+     */
25 25
     protected $content;
26 26
     
27
-   /**
28
-    * @var array
29
-    */
27
+    /**
28
+     * @var array
29
+     */
30 30
     protected $dispositionParams = array();
31 31
 
32
-   /**
33
-    * @var string
34
-    */
32
+    /**
33
+     * @var string
34
+     */
35 35
     protected $contentType = '';
36 36
 
37
-   /**
38
-    * @var string
39
-    */
37
+    /**
38
+     * @var string
39
+     */
40 40
     protected $contentEncoding = '';
41 41
     
42
-   /**
43
-    * @var RequestHelper_Boundaries
44
-    */
42
+    /**
43
+     * @var RequestHelper_Boundaries
44
+     */
45 45
     protected $boundaries;
46 46
     
47
-   /**
48
-    * @var string
49
-    */
47
+    /**
48
+     * @var string
49
+     */
50 50
     protected $transferEncoding = '';
51 51
     
52 52
     public function __construct(RequestHelper_Boundaries $boundaries, string $content)
@@ -60,46 +60,46 @@  discard block
 block discarded – undo
60 60
         return strlen($this->content);
61 61
     }
62 62
     
63
-   /**
64
-    * Sets the name of the request parameter.
65
-    * 
66
-    * @param string $name
67
-    * @return RequestHelper_Boundaries_Boundary
68
-    */
63
+    /**
64
+     * Sets the name of the request parameter.
65
+     * 
66
+     * @param string $name
67
+     * @return RequestHelper_Boundaries_Boundary
68
+     */
69 69
     public function setName(string $name) : RequestHelper_Boundaries_Boundary
70 70
     {
71 71
         return $this->setDispositionParam('name', $name);
72 72
     }
73 73
     
74
-   /**
75
-    * Sets the filename to use for the content, if applicable.
76
-    *  
77
-    * @param string $fileName
78
-    * @return RequestHelper_Boundaries_Boundary
79
-    */
74
+    /**
75
+     * Sets the filename to use for the content, if applicable.
76
+     *  
77
+     * @param string $fileName
78
+     * @return RequestHelper_Boundaries_Boundary
79
+     */
80 80
     public function setFileName(string $fileName) : RequestHelper_Boundaries_Boundary
81 81
     {
82 82
         return $this->setDispositionParam('filename', $fileName);
83 83
     }
84 84
     
85
-   /**
86
-    * Sets the content type to use for the content.
87
-    * 
88
-    * @param string $contentType
89
-    * @return RequestHelper_Boundaries_Boundary
90
-    */
85
+    /**
86
+     * Sets the content type to use for the content.
87
+     * 
88
+     * @param string $contentType
89
+     * @return RequestHelper_Boundaries_Boundary
90
+     */
91 91
     public function setContentType(string $contentType) : RequestHelper_Boundaries_Boundary
92 92
     {
93 93
         $this->contentType = $contentType;
94 94
         return $this;
95 95
     }
96 96
     
97
-   /**
98
-    * Sets the encoding to specify for the content.
99
-    * 
100
-    * @param string $encoding An encoding string, e.g. "UTF-8", "ASCII"
101
-    * @return RequestHelper_Boundaries_Boundary
102
-    */
97
+    /**
98
+     * Sets the encoding to specify for the content.
99
+     * 
100
+     * @param string $encoding An encoding string, e.g. "UTF-8", "ASCII"
101
+     * @return RequestHelper_Boundaries_Boundary
102
+     */
103 103
     public function setContentEncoding(string $encoding) : RequestHelper_Boundaries_Boundary
104 104
     {
105 105
         $this->contentEncoding = $encoding;
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
         return $this;
120 120
     }
121 121
     
122
-   /**
123
-    * Renders the mime boundary text.
124
-    * 
125
-    * @return string
126
-    */
122
+    /**
123
+     * Renders the mime boundary text.
124
+     * 
125
+     * @return string
126
+     */
127 127
     public function render()
128 128
     {
129 129
         $eol = $this->boundaries->getEOL();
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
         $lines[] = '--'.$this->boundaries->getMimeBoundary();
133 133
         $lines[] = $this->renderContentDisposition();
134 134
         
135
-        if(!empty($this->contentType)) 
135
+        if (!empty($this->contentType)) 
136 136
         {
137 137
             $lines[] = $this->renderContentType();
138 138
         }
139 139
         
140
-        if(!empty($this->transferEncoding))
140
+        if (!empty($this->transferEncoding))
141 141
         {
142 142
             $lines[] = $this->renderTransferEncoding();
143 143
         }
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
     {
153 153
         $result = 'Content-Disposition: form-data';
154 154
         
155
-        foreach($this->dispositionParams as $name => $value) 
155
+        foreach ($this->dispositionParams as $name => $value) 
156 156
         {
157
-            $result .= '; '.$name.'="' . $value . '"';
157
+            $result .= '; '.$name.'="'.$value.'"';
158 158
         }   
159 159
         
160 160
         return $result;
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
     
163 163
     protected function renderContentType() : string
164 164
     {
165
-        $result = 'Content-Type: ' . $this->contentType; 
165
+        $result = 'Content-Type: '.$this->contentType; 
166 166
         
167
-        if(!empty($this->contentEncoding)) 
167
+        if (!empty($this->contentEncoding)) 
168 168
         {
169
-            $result .= '; charset="' . $this->contentEncoding.'"';
169
+            $result .= '; charset="'.$this->contentEncoding.'"';
170 170
         }
171 171
         
172 172
         return $result;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     
175 175
     protected function renderTransferEncoding() : string
176 176
     {
177
-        $result = 'Content-Transfer-Encoding: ' . $this->transferEncoding;
177
+        $result = 'Content-Transfer-Encoding: '.$this->transferEncoding;
178 178
         
179 179
         return $result;
180 180
     }
Please login to merge, or discard this patch.
src/RequestHelper/Boundaries.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
     */
84 84
     public function addFile(string $varName, string $fileName, string $content, string $contentType = '', string $encoding = '') : RequestHelper_Boundaries
85 85
     {
86
-        if(empty($contentType))
86
+        if (empty($contentType))
87 87
         {
88 88
             $contentType = (string)FileHelper::detectMimeType($fileName);
89 89
         }
90 90
         
91
-        if(empty($encoding))
91
+        if (empty($encoding))
92 92
         {
93 93
             $encoding = RequestHelper::ENCODING_UTF8;
94 94
             $content = ConvertHelper::string2utf8($content);
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     */
154 154
     public function render() : string
155 155
     {
156
-        if(empty($this->boundaries)) 
156
+        if (empty($this->boundaries)) 
157 157
         {
158 158
             throw new RequestHelper_Exception(
159 159
                 'No mime boundaries added',
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
         
165 165
         $result = '';
166 166
         
167
-        foreach($this->boundaries as $boundary)
167
+        foreach ($this->boundaries as $boundary)
168 168
         {
169 169
             $result .= $boundary->render();
170 170
         }
171 171
         
172
-        $result .= "--" . $this->getMimeBoundary() . "--" . 
173
-        $this->getEOL() . $this->getEOL(); // always finish with two eol's!!
172
+        $result .= "--".$this->getMimeBoundary()."--". 
173
+        $this->getEOL().$this->getEOL(); // always finish with two eol's!!
174 174
         
175 175
         return $result;
176 176
     }
Please login to merge, or discard this patch.
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -22,19 +22,19 @@  discard block
 block discarded – undo
22 22
 {
23 23
     public const ERROR_NO_BOUNDARIES_SPECIFIED = 44401;
24 24
     
25
-   /**
26
-    * @var RequestHelper
27
-    */
25
+    /**
26
+     * @var RequestHelper
27
+     */
28 28
     protected $helper;
29 29
 
30
-   /**
31
-    * @var RequestHelper_Boundaries_Boundary[]
32
-    */
30
+    /**
31
+     * @var RequestHelper_Boundaries_Boundary[]
32
+     */
33 33
     protected $boundaries = array();
34 34
     
35
-   /**
36
-    * @var integer
37
-    */
35
+    /**
36
+     * @var integer
37
+     */
38 38
     protected $contentLength = 0;
39 39
     
40 40
     public function __construct(RequestHelper $helper)
@@ -42,31 +42,31 @@  discard block
 block discarded – undo
42 42
         $this->helper = $helper;
43 43
     }
44 44
     
45
-   /**
46
-    * Retrieves the string that is used to separate mime boundaries in the body.
47
-    * 
48
-    * @return string
49
-    */
45
+    /**
46
+     * Retrieves the string that is used to separate mime boundaries in the body.
47
+     * 
48
+     * @return string
49
+     */
50 50
     public function getMimeBoundary() : string
51 51
     {
52 52
         return $this->helper->getMimeBoundary();
53 53
     }
54 54
     
55
-   /**
56
-    * Retrieves the end of line character(s) used in the body.
57
-    * 
58
-    * @return string
59
-    */
55
+    /**
56
+     * Retrieves the end of line character(s) used in the body.
57
+     * 
58
+     * @return string
59
+     */
60 60
     public function getEOL() : string
61 61
     {
62 62
         return $this->helper->getEOL();
63 63
     }
64 64
     
65
-   /**
66
-    * Retrieves the total content length of all boundary contents.
67
-    * 
68
-    * @return int
69
-    */
65
+    /**
66
+     * Retrieves the total content length of all boundary contents.
67
+     * 
68
+     * @return int
69
+     */
70 70
     public function getContentLength() : int
71 71
     {
72 72
         // this must use strlen, and not mb_strlen: the content length
@@ -75,15 +75,15 @@  discard block
 block discarded – undo
75 75
         return strlen($this->render());
76 76
     }
77 77
     
78
-   /**
79
-    * Adds a file to be sent with the request.
80
-    *
81
-    * @param string $varName The variable name to send the file in
82
-    * @param string $fileName The name of the file as it should be received at the destination
83
-    * @param string $content The raw content of the file
84
-    * @param string $contentType The content type, use the constants to specify this
85
-    * @param string $encoding The encoding of the file, use the constants to specify this
86
-    */
78
+    /**
79
+     * Adds a file to be sent with the request.
80
+     *
81
+     * @param string $varName The variable name to send the file in
82
+     * @param string $fileName The name of the file as it should be received at the destination
83
+     * @param string $content The raw content of the file
84
+     * @param string $contentType The content type, use the constants to specify this
85
+     * @param string $encoding The encoding of the file, use the constants to specify this
86
+     */
87 87
     public function addFile(string $varName, string $fileName, string $content, string $contentType = '', string $encoding = '') : RequestHelper_Boundaries
88 88
     {
89 89
         if(empty($contentType))
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
         return $this->addBoundary($boundary);
108 108
     }
109 109
     
110
-   /**
111
-    * Adds arbitrary content.
112
-    *
113
-    * @param string $varName
114
-    * @param string $content
115
-    * @param string $contentType
116
-    */
110
+    /**
111
+     * Adds arbitrary content.
112
+     *
113
+     * @param string $varName
114
+     * @param string $content
115
+     * @param string $contentType
116
+     */
117 117
     public function addContent(string $varName, string $content, string $contentType) : RequestHelper_Boundaries
118 118
     {
119 119
         $content = ConvertHelper::string2utf8($content);
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
         return $this->addBoundary($boundary);
128 128
     }
129 129
     
130
-   /**
131
-    * Adds a variable to be sent with the request. If it
132
-    * already exists, its value is overwritten.
133
-    *
134
-    * @param string $name
135
-    * @param string $value
136
-    */
130
+    /**
131
+     * Adds a variable to be sent with the request. If it
132
+     * already exists, its value is overwritten.
133
+     *
134
+     * @param string $name
135
+     * @param string $value
136
+     */
137 137
     public function addVariable(string $name, string $value) : RequestHelper_Boundaries
138 138
     {
139 139
         $boundary = $this->createBoundary($value)
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
         return $this;
150 150
     }
151 151
     
152
-   /**
153
-    * Renders the response body with all mime boundaries.
154
-    * 
155
-    * @return string
156
-    */
152
+    /**
153
+     * Renders the response body with all mime boundaries.
154
+     * 
155
+     * @return string
156
+     */
157 157
     public function render() : string
158 158
     {
159 159
         if(empty($this->boundaries)) 
Please login to merge, or discard this patch.