Passed
Push — master ( a18c2c...41ea3f )
by Sebastian
02:50
created
src/XMLHelper/DOMErrors/Error.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     {
47 47
         $data = @json_decode($serialized, true);
48 48
         
49
-        if(!is_array($data))
49
+        if (!is_array($data))
50 50
         {
51 51
             throw new XMLHelper_Exception(
52 52
                 'Could not unserialize error data',
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
     
73 73
     private static function checkErrorData(array $data) : void
74 74
     {
75
-        foreach(self::$requiredKeys as $key)
75
+        foreach (self::$requiredKeys as $key)
76 76
         {
77
-            if(!array_key_exists($key, $data))
77
+            if (!array_key_exists($key, $data))
78 78
             {
79 79
                 throw new XMLHelper_Exception(
80 80
                     'Required key missing in error data',
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@
 block discarded – undo
24 24
     public const ERROR_CANNOT_UNSERIALIZE_ERROR_DATA = 57201;
25 25
     public const ERROR_ERROR_DATA_KEY_MISSING = 57202;
26 26
     
27
-   /**
28
-    * @var \LibXMLError
29
-    */
27
+    /**
28
+     * @var \LibXMLError
29
+     */
30 30
     private $error;
31 31
     
32 32
     private static $requiredKeys = array(
Please login to merge, or discard this patch.
src/XMLHelper/HTMLLoader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     */
108 108
     private static function checkFragment(string $fragment) : void
109 109
     {
110
-        if(!stristr($fragment, '<body') && !stristr($fragment, 'doctype'))
110
+        if (!stristr($fragment, '<body') && !stristr($fragment, 'doctype'))
111 111
         {
112 112
             return;
113 113
         }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         
208 208
         // capture all elements except the body tag itself
209 209
         $xml = '';
210
-        foreach($nodes as $child) 
210
+        foreach ($nodes as $child) 
211 211
         {
212 212
             $xml .= $this->dom->saveXML($child);
213 213
         }
Please login to merge, or discard this patch.
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -36,19 +36,19 @@  discard block
 block discarded – undo
36 36
 {
37 37
     public const ERROR_STRING_ALREADY_HAS_BODY_TAG = 57001;
38 38
     
39
-   /**
40
-    * @var \DOMElement
41
-    */
39
+    /**
40
+     * @var \DOMElement
41
+     */
42 42
     private $bodyNode;
43 43
     
44
-   /**
45
-    * @var XMLHelper_DOMErrors
46
-    */
44
+    /**
45
+     * @var XMLHelper_DOMErrors
46
+     */
47 47
     private $errors;
48 48
     
49
-   /**
50
-    * @var string
51
-    */
49
+    /**
50
+     * @var string
51
+     */
52 52
     private static $htmlTemplate = 
53 53
     '<!DOCTYPE html>'.
54 54
     '<html>'.
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
         '</body>'.
61 61
     '</html>';
62 62
     
63
-   /**
64
-    * @var \DOMDocument
65
-    */
63
+    /**
64
+     * @var \DOMDocument
65
+     */
66 66
     private $dom;
67 67
 
68 68
     private function __construct(string $html)
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
         $this->load($html);
71 71
     }
72 72
     
73
-   /**
74
-    * Creates an HTML loader from an HTML fragment (without
75
-    * doctype, head and body elements).
76
-    * 
77
-    * @param string $fragment
78
-    * @return XMLHelper_HTMLLoader
79
-    */
73
+    /**
74
+     * Creates an HTML loader from an HTML fragment (without
75
+     * doctype, head and body elements).
76
+     * 
77
+     * @param string $fragment
78
+     * @return XMLHelper_HTMLLoader
79
+     */
80 80
     public static function loadFragment(string $fragment) : XMLHelper_HTMLLoader
81 81
     {
82 82
         self::checkFragment($fragment);
@@ -87,24 +87,24 @@  discard block
 block discarded – undo
87 87
         return new XMLHelper_HTMLLoader($pseudoHTML);
88 88
     }
89 89
     
90
-   /**
91
-    * Creates an HTML loader from a full HTML document (including
92
-    * doctype, head and body elements).
93
-    * 
94
-    * @param string $html
95
-    * @return XMLHelper_HTMLLoader
96
-    */
90
+    /**
91
+     * Creates an HTML loader from a full HTML document (including
92
+     * doctype, head and body elements).
93
+     * 
94
+     * @param string $html
95
+     * @return XMLHelper_HTMLLoader
96
+     */
97 97
     public static function loadHTML(string $html) : XMLHelper_HTMLLoader
98 98
     {
99 99
         return  new XMLHelper_HTMLLoader($html);
100 100
     }
101 101
 
102
-   /**
103
-    * Verifies that the fragment does not already contain a body element or doctype.
104
-    * 
105
-    * @param string $fragment
106
-    * @throws XMLHelper_Exception
107
-    */
102
+    /**
103
+     * Verifies that the fragment does not already contain a body element or doctype.
104
+     * 
105
+     * @param string $fragment
106
+     * @throws XMLHelper_Exception
107
+     */
108 108
     private static function checkFragment(string $fragment) : void
109 109
     {
110 110
         if(!stristr($fragment, '<body') && !stristr($fragment, 'doctype'))
@@ -142,65 +142,65 @@  discard block
 block discarded – undo
142 142
         return $this->bodyNode;
143 143
     }
144 144
     
145
-   /**
146
-    * Retrieves the document's `<body>` tag node.
147
-    * 
148
-    * @return \DOMDocument
149
-    */
145
+    /**
146
+     * Retrieves the document's `<body>` tag node.
147
+     * 
148
+     * @return \DOMDocument
149
+     */
150 150
     public function getDOM() : \DOMDocument
151 151
     {
152 152
         return $this->dom;
153 153
     }
154 154
     
155
-   /**
156
-    * Retrieves all nodes from the HTML fragment (= child nodes
157
-    * of the `<body>` element).
158
-    * 
159
-    * @return \DOMNodeList
160
-    */
155
+    /**
156
+     * Retrieves all nodes from the HTML fragment (= child nodes
157
+     * of the `<body>` element).
158
+     * 
159
+     * @return \DOMNodeList
160
+     */
161 161
     public function getFragmentNodes() : \DOMNodeList
162 162
     {
163 163
         return $this->bodyNode->childNodes;
164 164
     }
165 165
     
166
-   /**
167
-    * Retrieves the LibXML HTML parsing errors collection, which
168
-    * can be used to review any errors that occurred while loading
169
-    * the HTML document.
170
-    * 
171
-    * @return XMLHelper_DOMErrors
172
-    */
166
+    /**
167
+     * Retrieves the LibXML HTML parsing errors collection, which
168
+     * can be used to review any errors that occurred while loading
169
+     * the HTML document.
170
+     * 
171
+     * @return XMLHelper_DOMErrors
172
+     */
173 173
     public function getErrors() : XMLHelper_DOMErrors
174 174
     {
175 175
         return $this->errors;
176 176
     }
177 177
     
178
-   /**
179
-    * Returns a valid HTML string.
180
-    * 
181
-    * @return string
182
-    */
178
+    /**
179
+     * Returns a valid HTML string.
180
+     * 
181
+     * @return string
182
+     */
183 183
     public function toHTML() : string
184 184
     {
185 185
         return $this->dom->saveHTML();
186 186
     }
187 187
     
188
-   /**
189
-    * Returns a valid XML string.
190
-    * 
191
-    * @return string
192
-    */
188
+    /**
189
+     * Returns a valid XML string.
190
+     * 
191
+     * @return string
192
+     */
193 193
     public function toXML() : string
194 194
     {
195 195
         return $this->dom->saveXML();
196 196
     }
197 197
     
198
-   /**
199
-    * Converts the HTML fragment to valid XML (= all
200
-    * child nodes of the `<body>` element).
201
-    * 
202
-    * @return string
203
-    */
198
+    /**
199
+     * Converts the HTML fragment to valid XML (= all
200
+     * child nodes of the `<body>` element).
201
+     * 
202
+     * @return string
203
+     */
204 204
     public function fragmentToXML() : string
205 205
     {
206 206
         $nodes = $this->getFragmentNodes();
Please login to merge, or discard this patch.
src/XMLHelper/DOMErrors.php 3 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
     */
34 34
     public function __construct(array $libxmlErrors)
35 35
     {
36
-        foreach($libxmlErrors as $error)
36
+        foreach ($libxmlErrors as $error)
37 37
         {
38
-            if($error instanceof XMLHelper_DOMErrors_Error)
38
+            if ($error instanceof XMLHelper_DOMErrors_Error)
39 39
             {
40 40
                 $this->errors[] = $error;
41 41
             }
42
-            else if($error instanceof \LibXMLError)
42
+            else if ($error instanceof \LibXMLError)
43 43
             {
44 44
                 $this->errors[] = new XMLHelper_DOMErrors_Error($error);
45 45
             }
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
     {
118 118
         $result = array();
119 119
         
120
-        foreach($this->errors as $error)
120
+        foreach ($this->errors as $error)
121 121
         {
122
-            if($error->isLevel($level))
122
+            if ($error->isLevel($level))
123 123
             {
124 124
                 $result[] = $error;
125 125
             }
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
     {
139 139
         $result = array();
140 140
         
141
-        foreach($this->errors as $error)
141
+        foreach ($this->errors as $error)
142 142
         {
143
-            if($error->isCode($code))
143
+            if ($error->isCode($code))
144 144
             {
145 145
                 $result[] = $error;
146 146
             }
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
     */
158 158
     public function hasErrorsByLevel(int $level) : bool
159 159
     {
160
-        foreach($this->errors as $error)
160
+        foreach ($this->errors as $error)
161 161
         {
162
-            if($error->isLevel($level))
162
+            if ($error->isLevel($level))
163 163
             {
164 164
                 return true;
165 165
             }
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
     */
177 177
     public function hasErrorsByCode(int $code) : bool
178 178
     {
179
-        foreach($this->errors as $error)
179
+        foreach ($this->errors as $error)
180 180
         {
181
-            if($error->isCode($code))
181
+            if ($error->isCode($code))
182 182
             {
183 183
                 return true;
184 184
             }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     {
192 192
         $result = array();
193 193
         
194
-        foreach($this->errors as $error)
194
+        foreach ($this->errors as $error)
195 195
         {
196 196
             $result[] = $error->toArray();
197 197
         }
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
     {
211 211
         $data = array();
212 212
         
213
-        foreach($this->errors as $error)
213
+        foreach ($this->errors as $error)
214 214
         {
215 215
             $data[] = $error->serialize();
216 216
         }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         $parts = explode(self::SERIALIZE_SEPARATOR, $serialized);
232 232
         $list = array();
233 233
         
234
-        foreach($parts as $part)
234
+        foreach ($parts as $part)
235 235
         {
236 236
             $list[] = XMLHelper_DOMErrors_Error::fromSerialized($part);
237 237
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,7 @@
 block discarded – undo
38 38
             if($error instanceof XMLHelper_DOMErrors_Error)
39 39
             {
40 40
                 $this->errors[] = $error;
41
-            }
42
-            else if($error instanceof \LibXMLError)
41
+            } else if($error instanceof \LibXMLError)
43 42
             {
44 43
                 $this->errors[] = new XMLHelper_DOMErrors_Error($error);
45 44
             }
Please login to merge, or discard this patch.
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 {
24 24
     public const SERIALIZE_SEPARATOR = '__SERSEP__';
25 25
     
26
-   /**
27
-    * @var XMLHelper_DOMErrors_Error[]
28
-    */
26
+    /**
27
+     * @var XMLHelper_DOMErrors_Error[]
28
+     */
29 29
     private $errors;
30 30
     
31
-   /**
32
-    * @param \LibXMLError[]|XMLHelper_DOMErrors_Error[] $libxmlErrors
33
-    */
31
+    /**
32
+     * @param \LibXMLError[]|XMLHelper_DOMErrors_Error[] $libxmlErrors
33
+     */
34 34
     public function __construct(array $libxmlErrors)
35 35
     {
36 36
         foreach($libxmlErrors as $error)
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
         return $this->errors;
57 57
     }
58 58
     
59
-   /**
60
-    * Retrieves all warnings, if any.
61
-    * 
62
-    * @return XMLHelper_DOMErrors_Error[]
63
-    */
59
+    /**
60
+     * Retrieves all warnings, if any.
61
+     * 
62
+     * @return XMLHelper_DOMErrors_Error[]
63
+     */
64 64
     public function getWarnings()
65 65
     {
66 66
         return $this->getByLevel(LIBXML_ERR_WARNING);
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
     }
108 108
     
109 109
     
110
-   /**
111
-    * Retrieves all errors by the specified libxml error level.
112
-    * 
113
-    * @param int $level
114
-    * @return \AppUtils\XMLHelper_DOMErrors_Error[]
115
-    */
110
+    /**
111
+     * Retrieves all errors by the specified libxml error level.
112
+     * 
113
+     * @param int $level
114
+     * @return \AppUtils\XMLHelper_DOMErrors_Error[]
115
+     */
116 116
     public function getByLevel(int $level)
117 117
     {
118 118
         $result = array();
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
         return $result;
129 129
     }
130 130
     
131
-   /**
132
-    * Retrieves all errors by the specified libxml error code.
133
-    * 
134
-    * @param int $code
135
-    * @return \AppUtils\XMLHelper_DOMErrors_Error[]
136
-    */
131
+    /**
132
+     * Retrieves all errors by the specified libxml error code.
133
+     * 
134
+     * @param int $code
135
+     * @return \AppUtils\XMLHelper_DOMErrors_Error[]
136
+     */
137 137
     public function getByCode(int $code)
138 138
     {
139 139
         $result = array();
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
         return $result;
150 150
     }
151 151
     
152
-   /**
153
-    * Checks whether there are errors matching the libxml error level.
154
-    * 
155
-    * @param int $level
156
-    * @return bool
157
-    */
152
+    /**
153
+     * Checks whether there are errors matching the libxml error level.
154
+     * 
155
+     * @param int $level
156
+     * @return bool
157
+     */
158 158
     public function hasErrorsByLevel(int $level) : bool
159 159
     {
160 160
         foreach($this->errors as $error)
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
         return false;
169 169
     }
170 170
     
171
-   /**
172
-    * Checks whether there are any errors matching the libxml error code.
173
-    * 
174
-    * @param int $code
175
-    * @return bool
176
-    */
171
+    /**
172
+     * Checks whether there are any errors matching the libxml error code.
173
+     * 
174
+     * @param int $code
175
+     * @return bool
176
+     */
177 177
     public function hasErrorsByCode(int $code) : bool
178 178
     {
179 179
         foreach($this->errors as $error)
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
         return $result;
200 200
     }
201 201
     
202
-   /**
203
-    * Serializes the errors collection, so it can be stored and
204
-    * restored as needed, using the `fromSerialized()` method.
205
-    * 
206
-    * @return string
207
-    * @see XMLHelper_DOMErrors::fromSerialized()
208
-    */
202
+    /**
203
+     * Serializes the errors collection, so it can be stored and
204
+     * restored as needed, using the `fromSerialized()` method.
205
+     * 
206
+     * @return string
207
+     * @see XMLHelper_DOMErrors::fromSerialized()
208
+     */
209 209
     public function serialize() : string
210 210
     {
211 211
         $data = array();
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
         return implode(self::SERIALIZE_SEPARATOR, $data);
219 219
     }
220 220
     
221
-   /**
222
-    * Restores the errors collection from a previously serialized
223
-    * collection, using `serialize()`. 
224
-    * 
225
-    * @param string $serialized
226
-    * @return XMLHelper_DOMErrors
227
-    * @see XMLHelper_DOMErrors::serialize()
228
-    */
221
+    /**
222
+     * Restores the errors collection from a previously serialized
223
+     * collection, using `serialize()`. 
224
+     * 
225
+     * @param string $serialized
226
+     * @return XMLHelper_DOMErrors
227
+     * @see XMLHelper_DOMErrors::serialize()
228
+     */
229 229
     public static function fromSerialized(string $serialized) : XMLHelper_DOMErrors
230 230
     {
231 231
         $parts = explode(self::SERIALIZE_SEPARATOR, $serialized);
Please login to merge, or discard this patch.
docs/libxml/generate-errorcodes.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@
 block discarded – undo
14 14
  * @see http://www.xmlsoft.org/html/libxml-xmlerror.html
15 15
  */
16 16
 
17
-   /**
18
-    * @var string $list
19
-    */
17
+    /**
18
+     * @var string $list
19
+     */
20 20
     $list = file_get_contents('libxmlerrors.txt');
21 21
     $outputFile = 'LibXML.php';
22 22
     $lines = explode("\n", $list);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     $lines = explode("\n", $list);
23 23
     $reverseArray = array();
24 24
     
25
-    foreach($lines as $line)
25
+    foreach ($lines as $line)
26 26
     {
27 27
         $parts = explode('=', $line);
28 28
         $name = trim(str_replace('XML_ERR_', '', $parts[0]));
Please login to merge, or discard this patch.
src/Request/RefreshParams/Exclude/Name.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@
 block discarded – undo
19 19
  */
20 20
 class Request_RefreshParams_Exclude_Name extends Request_RefreshParams_Exclude
21 21
 {
22
-   /**
23
-    * @var string
24
-    */
22
+    /**
23
+     * @var string
24
+     */
25 25
     private $name;
26 26
     
27 27
     public function __construct(string $paramName)
Please login to merge, or discard this patch.
src/Request/RefreshParams/Exclude/Callback.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     
30 30
     public function __construct($callback)
31 31
     {
32
-        if(!is_callable($callback))
32
+        if (!is_callable($callback))
33 33
         {
34 34
             throw new Request_Exception(
35 35
                 'Invalid exclusion callback',
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
22 22
 {
23 23
     public const ERROR_INVALID_CALLBACK = 62101;
24 24
     
25
-   /**
26
-    * @var callable
27
-    */
25
+    /**
26
+     * @var callable
27
+     */
28 28
     private $callback;
29 29
     
30 30
     public function __construct($callback)
Please login to merge, or discard this patch.
src/Request/RefreshParams.php 2 patches
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 {
24 24
     use Traits_Optionable;
25 25
     
26
-   /**
27
-    * @var array<string,mixed>
28
-    */
26
+    /**
27
+     * @var array<string,mixed>
28
+     */
29 29
     private $overrides = array();
30 30
     
31
-   /**
32
-    * @var Request_RefreshParams_Exclude[]
33
-    */
31
+    /**
32
+     * @var Request_RefreshParams_Exclude[]
33
+     */
34 34
     private $excludes = array();
35 35
     
36 36
     public function getDefaultOptions() : array
@@ -41,27 +41,27 @@  discard block
 block discarded – undo
41 41
         );
42 42
     }
43 43
     
44
-   /**
45
-    * Whether to automatically exclude the session variable
46
-    * from the parameters.
47
-    * 
48
-    * @param bool $exclude
49
-    * @return Request_RefreshParams
50
-    */
44
+    /**
45
+     * Whether to automatically exclude the session variable
46
+     * from the parameters.
47
+     * 
48
+     * @param bool $exclude
49
+     * @return Request_RefreshParams
50
+     */
51 51
     public function setExcludeSessionName(bool $exclude=true) : Request_RefreshParams
52 52
     {
53 53
         $this->setOption('exclude-session-name', $exclude);
54 54
         return $this;
55 55
     }
56 56
     
57
-   /**
58
-    * Whether to automatically exclude the HTML_QuickForm2
59
-    * request variable used to track whether a form has been
60
-    * submitted.
61
-    * 
62
-    * @param bool $exclude
63
-    * @return Request_RefreshParams
64
-    */
57
+    /**
58
+     * Whether to automatically exclude the HTML_QuickForm2
59
+     * request variable used to track whether a form has been
60
+     * submitted.
61
+     * 
62
+     * @param bool $exclude
63
+     * @return Request_RefreshParams
64
+     */
65 65
     public function setExcludeQuickform(bool $exclude) : Request_RefreshParams
66 66
     {
67 67
         $this->setOption('exclude-quickform-submitter', $exclude);
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
         return $this;
79 79
     }
80 80
     
81
-   /**
82
-    * Exclude a request using a callback function.
83
-    * 
84
-    * The function gets two parameters:
85
-    * 
86
-    * - The name of the request parameter
87
-    * - The value of the request parameter
88
-    * 
89
-    * If the callback returns a boolean true, the
90
-    * parameter will be excluded.
91
-    * 
92
-    * @param callable $callback
93
-    * @return Request_RefreshParams
94
-    */
81
+    /**
82
+     * Exclude a request using a callback function.
83
+     * 
84
+     * The function gets two parameters:
85
+     * 
86
+     * - The name of the request parameter
87
+     * - The value of the request parameter
88
+     * 
89
+     * If the callback returns a boolean true, the
90
+     * parameter will be excluded.
91
+     * 
92
+     * @param callable $callback
93
+     * @return Request_RefreshParams
94
+     */
95 95
     public function excludeParamByCallback($callback) : Request_RefreshParams
96 96
     {
97 97
         $this->excludes[] = new Request_RefreshParams_Exclude_Callback($callback);
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
         return $this;
100 100
     }
101 101
     
102
-   /**
103
-    * Excludes a request parameter by name.
104
-    * 
105
-    * @param array $paramNames
106
-    * @return Request_RefreshParams
107
-    */
102
+    /**
103
+     * Excludes a request parameter by name.
104
+     * 
105
+     * @param array $paramNames
106
+     * @return Request_RefreshParams
107
+     */
108 108
     public function excludeParamsByName(array $paramNames) : Request_RefreshParams
109 109
     {
110 110
         foreach($paramNames as $name)
@@ -115,15 +115,15 @@  discard block
 block discarded – undo
115 115
         return $this;
116 116
     }
117 117
     
118
-   /**
119
-    * Overrides a parameter: even if it exists, this
120
-    * value will be used instead - even if it is on 
121
-    * the list of excluded parameters.
122
-    * 
123
-    * @param string $paramName
124
-    * @param mixed $paramValue
125
-    * @return Request_RefreshParams
126
-    */
118
+    /**
119
+     * Overrides a parameter: even if it exists, this
120
+     * value will be used instead - even if it is on 
121
+     * the list of excluded parameters.
122
+     * 
123
+     * @param string $paramName
124
+     * @param mixed $paramValue
125
+     * @return Request_RefreshParams
126
+     */
127 127
     public function overrideParam(string $paramName, $paramValue) : Request_RefreshParams
128 128
     {
129 129
         $this->overrides[$paramName] = $paramValue;
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
         return $this;
132 132
     }
133 133
     
134
-   /**
135
-    * Overrides an array of parameters. 
136
-    * 
137
-    * @param array $params
138
-    * @return Request_RefreshParams
139
-    */
134
+    /**
135
+     * Overrides an array of parameters. 
136
+     * 
137
+     * @param array $params
138
+     * @return Request_RefreshParams
139
+     */
140 140
     public function overrideParams(array $params) : Request_RefreshParams
141 141
     {
142 142
         foreach($params as $name => $value)
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
         return $this;
148 148
     }
149 149
     
150
-   /**
151
-    * Resolves all the parameter exclusions that should
152
-    * be applied to the list of parameters. This includes
153
-    * the manually added exclusions and the dynamic exclusions
154
-    * like the session name.
155
-    * 
156
-    * @return Request_RefreshParams_Exclude[]
157
-    */
150
+    /**
151
+     * Resolves all the parameter exclusions that should
152
+     * be applied to the list of parameters. This includes
153
+     * the manually added exclusions and the dynamic exclusions
154
+     * like the session name.
155
+     * 
156
+     * @return Request_RefreshParams_Exclude[]
157
+     */
158 158
     private function resolveExcludes() : array
159 159
     {
160 160
         $excludes = $this->excludes;
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
         return $excludes;
166 166
     }
167 167
     
168
-   /**
169
-    * Automatically excludes the session name from the
170
-    * parameters, if present.
171
-    * 
172
-    * @param Request_RefreshParams_Exclude[] $excludes
173
-    */
168
+    /**
169
+     * Automatically excludes the session name from the
170
+     * parameters, if present.
171
+     * 
172
+     * @param Request_RefreshParams_Exclude[] $excludes
173
+     */
174 174
     private function autoExcludeSessionName(array &$excludes) : void
175 175
     {
176 176
         if($this->getBoolOption('exclude-session-name'))
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
         }
180 180
     }
181 181
    
182
-   /**
183
-    * Automatically excludes the HTML_QuickForm2 submit
184
-    * tracking variable, when enabled.
185
-    * 
186
-    * @param Request_RefreshParams_Exclude[] $excludes
187
-    */
182
+    /**
183
+     * Automatically excludes the HTML_QuickForm2 submit
184
+     * tracking variable, when enabled.
185
+     * 
186
+     * @param Request_RefreshParams_Exclude[] $excludes
187
+     */
188 188
     private function autoExcludeQuickform(array &$excludes) : void
189 189
     {
190 190
         if($this->getBoolOption('exclude-quickform-submitter'))
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
         }
197 197
     }
198 198
     
199
-   /**
200
-    * Retrieves the list of parameters matching the 
201
-    * current settings.
202
-    * 
203
-    * @return array<string,mixed>
204
-    */
199
+    /**
200
+     * Retrieves the list of parameters matching the 
201
+     * current settings.
202
+     * 
203
+     * @return array<string,mixed>
204
+     */
205 205
     public function getParams() : array
206 206
     {
207 207
         $params = $this->removeExcluded($_REQUEST);
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
         return $params;
218 218
     }
219 219
     
220
-   /**
221
-    * Removes all excluded parameters from the array.
222
-    * 
223
-    * @param array<string,mixed> $params
224
-    * @return array<string,mixed>
225
-    */
220
+    /**
221
+     * Removes all excluded parameters from the array.
222
+     * 
223
+     * @param array<string,mixed> $params
224
+     * @return array<string,mixed>
225
+     */
226 226
     private function removeExcluded(array $params) : array
227 227
     {
228 228
         $result = array();
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
         return $result;
241 241
     }
242 242
     
243
-   /**
244
-    * Checks all configured exclusions to see if the 
245
-    * parameter should be excluded or not.
246
-    * 
247
-    * @param string $paramName
248
-    * @param mixed $paramValue
249
-    * @return bool
250
-    */
243
+    /**
244
+     * Checks all configured exclusions to see if the 
245
+     * parameter should be excluded or not.
246
+     * 
247
+     * @param string $paramName
248
+     * @param mixed $paramValue
249
+     * @return bool
250
+     */
251 251
     public function isExcluded(string $paramName, $paramValue) : bool
252 252
     {
253 253
         $excludes = $this->resolveExcludes();
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     * @param bool $exclude
49 49
     * @return Request_RefreshParams
50 50
     */
51
-    public function setExcludeSessionName(bool $exclude=true) : Request_RefreshParams
51
+    public function setExcludeSessionName(bool $exclude = true) : Request_RefreshParams
52 52
     {
53 53
         $this->setOption('exclude-session-name', $exclude);
54 54
         return $this;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     
71 71
     public function excludeParamByName(string $paramName) : Request_RefreshParams
72 72
     {
73
-        if($paramName !== '')
73
+        if ($paramName !== '')
74 74
         {
75 75
             $this->excludes[] = new Request_RefreshParams_Exclude_Name($paramName);
76 76
         }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     */
108 108
     public function excludeParamsByName(array $paramNames) : Request_RefreshParams
109 109
     {
110
-        foreach($paramNames as $name)
110
+        foreach ($paramNames as $name)
111 111
         {
112 112
             $this->excludeParamByName((string)$name);
113 113
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     */
140 140
     public function overrideParams(array $params) : Request_RefreshParams
141 141
     {
142
-        foreach($params as $name => $value)
142
+        foreach ($params as $name => $value)
143 143
         {
144 144
             $this->overrideParam((string)$name, $value);
145 145
         }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     */
174 174
     private function autoExcludeSessionName(array &$excludes) : void
175 175
     {
176
-        if($this->getBoolOption('exclude-session-name'))
176
+        if ($this->getBoolOption('exclude-session-name'))
177 177
         {
178 178
             $excludes[] = new Request_RefreshParams_Exclude_Name(session_name());
179 179
         }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     */
188 188
     private function autoExcludeQuickform(array &$excludes) : void
189 189
     {
190
-        if($this->getBoolOption('exclude-quickform-submitter'))
190
+        if ($this->getBoolOption('exclude-quickform-submitter'))
191 191
         {
192 192
             $excludes[] = new Request_RefreshParams_Exclude_Callback(function(string $paramName)
193 193
             {
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         // Note: using this loop instead of array_merge,
210 210
         // because array_merge has weird behavior when
211 211
         // using numeric keys.
212
-        foreach($this->overrides as $name => $val)
212
+        foreach ($this->overrides as $name => $val)
213 213
         {
214 214
             $params[$name] = $val;
215 215
         }
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
     {
228 228
         $result = array();
229 229
         
230
-        foreach($params as $name => $value)
230
+        foreach ($params as $name => $value)
231 231
         {
232 232
             $name = (string)$name;
233 233
             
234
-            if(!$this->isExcluded($name, $value))
234
+            if (!$this->isExcluded($name, $value))
235 235
             {
236 236
                 $result[$name] = $value;
237 237
             }
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
     {
253 253
         $excludes = $this->resolveExcludes();
254 254
         
255
-        foreach($excludes as $exclude)
255
+        foreach ($excludes as $exclude)
256 256
         {
257
-            if($exclude->isExcluded($paramName, $paramValue))
257
+            if ($exclude->isExcluded($paramName, $paramValue))
258 258
             {
259 259
                 return true;
260 260
             }
Please login to merge, or discard this patch.
src/RequestHelper.php 3 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
         $output = curl_exec($ch);
243 243
 
244
-        if(isset($this->logfilePointer))
244
+        if (isset($this->logfilePointer))
245 245
         {
246 246
             fclose($this->logfilePointer);
247 247
         }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         // CURL will complain about an empty response when the 
254 254
         // server sends a 100-continue code. That should not be
255 255
         // regarded as an error.
256
-        if($output === false && $this->response->getCode() !== 100)
256
+        if ($output === false && $this->response->getCode() !== 100)
257 257
         {
258 258
             $curlCode = curl_errno($ch);
259 259
             
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     {
290 290
         $ch = curl_init();
291 291
         
292
-        if(!is_resource($ch))
292
+        if (!is_resource($ch))
293 293
         {
294 294
             throw new RequestHelper_Exception(
295 295
                 'Could not initialize a new cURL instance.',
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
         }
300 300
 
301 301
         $this->setHeader('Content-Length', (string)$this->boundaries->getContentLength());
302
-        $this->setHeader('Content-Type', 'multipart/form-data; boundary=' . $this->mimeBoundary);
302
+        $this->setHeader('Content-Type', 'multipart/form-data; boundary='.$this->mimeBoundary);
303 303
 
304 304
         curl_setopt($ch, CURLOPT_POST, true);
305 305
         curl_setopt($ch, CURLOPT_URL, $url->getNormalizedWithoutAuth());
@@ -312,18 +312,18 @@  discard block
 block discarded – undo
312 312
         
313 313
         $loggingEnabled = $this->configureLogging($ch);
314 314
         
315
-        if(!$loggingEnabled) 
315
+        if (!$loggingEnabled) 
316 316
         {
317 317
             curl_setopt($ch, CURLINFO_HEADER_OUT, true);
318 318
         }
319 319
         
320
-        if($this->verifySSL)
320
+        if ($this->verifySSL)
321 321
         {
322 322
             curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
323 323
             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
324 324
         }
325 325
         
326
-        if($url->hasUsername())
326
+        if ($url->hasUsername())
327 327
         {
328 328
             curl_setopt($ch, CURLOPT_USERNAME, $url->getUsername());
329 329
             curl_setopt($ch, CURLOPT_PASSWORD, $url->getPassword());
@@ -338,14 +338,14 @@  discard block
 block discarded – undo
338 338
     */
339 339
     protected function configureLogging($ch) : bool
340 340
     {
341
-        if(empty($this->logfile))
341
+        if (empty($this->logfile))
342 342
         {
343 343
             return false;
344 344
         }
345 345
         
346 346
         $res = fopen($this->logfile, 'w+');
347 347
         
348
-        if($res === false)
348
+        if ($res === false)
349 349
         {
350 350
             throw new RequestHelper_Exception(
351 351
                 'Cannot open logfile for writing.',
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
         
376 376
         $this->setHeader('Expect', '');
377 377
         
378
-        foreach($this->headers as $name => $value) {
378
+        foreach ($this->headers as $name => $value) {
379 379
             $result[] = $name.': '.$value;
380 380
         }
381 381
         
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
     {
393 393
         $response = $this->getResponse();
394 394
         
395
-        if($response !== null) {
395
+        if ($response !== null) {
396 396
             return $response->getHeaders();
397 397
         }
398 398
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
     */
429 429
     public function getHeader(string $name) : string
430 430
     {
431
-        if(isset($this->headers[$name]))
431
+        if (isset($this->headers[$name]))
432 432
         {
433 433
             return $this->headers[$name];
434 434
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -261,8 +261,7 @@
 block discarded – undo
261 261
                 $curlCode,
262 262
                 curl_error($ch).' | Explanation: '.curl_strerror($curlCode)
263 263
             );
264
-        }
265
-        else
264
+        } else
266 265
         {
267 266
             $this->response->setBody((string)$output);
268 267
         }
Please login to merge, or discard this patch.
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -32,62 +32,62 @@  discard block
 block discarded – undo
32 32
     public const ERROR_CURL_INIT_FAILED = 17903;
33 33
     public const ERROR_CANNOT_OPEN_LOGFILE = 17904;
34 34
 
35
-   /**
36
-    * @var string
37
-    */
35
+    /**
36
+     * @var string
37
+     */
38 38
     protected $eol = "\r\n";
39 39
 
40
-   /**
41
-    * @var string
42
-    */
40
+    /**
41
+     * @var string
42
+     */
43 43
     protected $mimeBoundary;
44 44
 
45
-   /**
46
-    * @var string
47
-    */
45
+    /**
46
+     * @var string
47
+     */
48 48
     protected $destination;
49 49
 
50
-   /**
51
-    * @var array<string,string>
52
-    */
50
+    /**
51
+     * @var array<string,string>
52
+     */
53 53
     protected $headers = array();
54 54
     
55
-   /**
56
-    * Whether to verify SSL certificates.
57
-    * @var bool
58
-    */
55
+    /**
56
+     * Whether to verify SSL certificates.
57
+     * @var bool
58
+     */
59 59
     protected $verifySSL = true;
60 60
     
61
-   /**
62
-    * @var RequestHelper_Boundaries
63
-    */
61
+    /**
62
+     * @var RequestHelper_Boundaries
63
+     */
64 64
     protected $boundaries;
65 65
     
66
-   /**
67
-    * @var RequestHelper_Response|NULL
68
-    */
66
+    /**
67
+     * @var RequestHelper_Response|NULL
68
+     */
69 69
     protected $response;
70 70
 
71
-   /**
72
-    * Timeout duration, in seconds.
73
-    * @var integer
74
-    */
71
+    /**
72
+     * Timeout duration, in seconds.
73
+     * @var integer
74
+     */
75 75
     protected $timeout = 30;
76 76
     
77
-   /**
78
-    * @var string
79
-    */
77
+    /**
78
+     * @var string
79
+     */
80 80
     protected $logfile = '';
81 81
 
82
-   /**
83
-    * @var resource|NULL
84
-    */
82
+    /**
83
+     * @var resource|NULL
84
+     */
85 85
     protected $logfilePointer = null;
86 86
     
87
-   /**
88
-    * Creates a new request helper to send POST data to the specified destination URL.
89
-    * @param string $destinationURL
90
-    */
87
+    /**
88
+     * Creates a new request helper to send POST data to the specified destination URL.
89
+     * @param string $destinationURL
90
+     */
91 91
     public function __construct(string $destinationURL)
92 92
     {
93 93
         $this->destination = $destinationURL;
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
         return $this->eol;
111 111
     }
112 112
     
113
-   /**
114
-    * Sets the timeout for the request, in seconds. If the request
115
-    * takes longer, it will be cancelled and an exception triggered.
116
-    * 
117
-    * @param int $seconds
118
-    * @return RequestHelper
119
-    */
113
+    /**
114
+     * Sets the timeout for the request, in seconds. If the request
115
+     * takes longer, it will be cancelled and an exception triggered.
116
+     * 
117
+     * @param int $seconds
118
+     * @return RequestHelper
119
+     */
120 120
     public function setTimeout(int $seconds) : RequestHelper
121 121
     {
122 122
         $this->timeout = $seconds;
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
         return $this->timeout;
130 130
     }
131 131
     
132
-   /**
133
-    * Enables verbose logging of the CURL request, which
134
-    * is then redirected to the target file.
135
-    * 
136
-    * @param string $targetFile
137
-    * @return RequestHelper
138
-    */
132
+    /**
133
+     * Enables verbose logging of the CURL request, which
134
+     * is then redirected to the target file.
135
+     * 
136
+     * @param string $targetFile
137
+     * @return RequestHelper
138
+     */
139 139
     public function enableLogging(string $targetFile) : RequestHelper
140 140
     {
141 141
         $this->logfile = $targetFile;
@@ -143,15 +143,15 @@  discard block
 block discarded – undo
143 143
         return $this;
144 144
     }
145 145
 
146
-   /**
147
-    * Adds a file to be sent with the request.
148
-    *
149
-    * @param string $varName The variable name to send the file in
150
-    * @param string $fileName The name of the file as it should be received at the destination
151
-    * @param string $content The raw content of the file
152
-    * @param string $contentType The content type, use the constants to specify this
153
-    * @param string $encoding The encoding of the file, use the constants to specify this
154
-    */
146
+    /**
147
+     * Adds a file to be sent with the request.
148
+     *
149
+     * @param string $varName The variable name to send the file in
150
+     * @param string $fileName The name of the file as it should be received at the destination
151
+     * @param string $content The raw content of the file
152
+     * @param string $contentType The content type, use the constants to specify this
153
+     * @param string $encoding The encoding of the file, use the constants to specify this
154
+     */
155 155
     public function addFile(string $varName, string $fileName, string $content, string $contentType = '', string $encoding = '') : RequestHelper
156 156
     {
157 157
         $this->boundaries->addFile($varName, $fileName, $content, $contentType, $encoding);
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
         return $this;
160 160
     }
161 161
     
162
-   /**
163
-    * Adds arbitrary content.
164
-    * 
165
-    * @param string $varName The variable name to send the content in.
166
-    * @param string $content
167
-    * @param string $contentType
168
-    */
162
+    /**
163
+     * Adds arbitrary content.
164
+     * 
165
+     * @param string $varName The variable name to send the content in.
166
+     * @param string $content
167
+     * @param string $contentType
168
+     */
169 169
     public function addContent(string $varName, string $content, string $contentType) : RequestHelper
170 170
     {
171 171
         $this->boundaries->addContent($varName, $content, $contentType);
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
         return $this;
174 174
     }
175 175
 
176
-   /**
177
-    * Adds a variable to be sent with the request. If it
178
-    * already exists, its value is overwritten.
179
-    *
180
-    * @param string $name
181
-    * @param string $value
182
-    */
176
+    /**
177
+     * Adds a variable to be sent with the request. If it
178
+     * already exists, its value is overwritten.
179
+     *
180
+     * @param string $name
181
+     * @param string $value
182
+     */
183 183
     public function addVariable(string $name, string $value) : RequestHelper
184 184
     {
185 185
         $this->boundaries->addVariable($name, $value);
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
         return $this;
188 188
     }
189 189
     
190
-   /**
191
-    * Sets an HTTP header to include in the request.
192
-    * 
193
-    * @param string $name
194
-    * @param string $value
195
-    * @return RequestHelper
196
-    */
190
+    /**
191
+     * Sets an HTTP header to include in the request.
192
+     * 
193
+     * @param string $name
194
+     * @param string $value
195
+     * @return RequestHelper
196
+     */
197 197
     public function setHeader(string $name, string $value) : RequestHelper
198 198
     {
199 199
         $this->headers[$name] = $value;
@@ -201,36 +201,36 @@  discard block
 block discarded – undo
201 201
         return $this;
202 202
     }
203 203
     
204
-   /**
205
-    * Disables SSL certificate checking.
206
-    * 
207
-    * @return RequestHelper
208
-    */
204
+    /**
205
+     * Disables SSL certificate checking.
206
+     * 
207
+     * @return RequestHelper
208
+     */
209 209
     public function disableSSLChecks() : RequestHelper
210 210
     {
211 211
         $this->verifySSL = false;
212 212
         return $this;
213 213
     }
214 214
    
215
-   /**
216
-    * @var integer
217
-    */
215
+    /**
216
+     * @var integer
217
+     */
218 218
     protected $contentLength = 0;
219 219
 
220
-   /**
221
-    * Sends the POST request to the destination, and returns
222
-    * the response text.
223
-    *
224
-    * The response object is stored internally, so after calling
225
-    * this method it may be retrieved at any moment using the
226
-    * {@link getResponse()} method.
227
-    *
228
-    * @return string
229
-    * @see RequestHelper::getResponse()
230
-    * @throws RequestHelper_Exception
231
-    * 
232
-    * @see RequestHelper::ERROR_REQUEST_FAILED
233
-    */
220
+    /**
221
+     * Sends the POST request to the destination, and returns
222
+     * the response text.
223
+     *
224
+     * The response object is stored internally, so after calling
225
+     * this method it may be retrieved at any moment using the
226
+     * {@link getResponse()} method.
227
+     *
228
+     * @return string
229
+     * @see RequestHelper::getResponse()
230
+     * @throws RequestHelper_Exception
231
+     * 
232
+     * @see RequestHelper::ERROR_REQUEST_FAILED
233
+     */
234 234
     public function send() : string
235 235
     {
236 236
         $info = parseURL($this->destination);
@@ -270,26 +270,26 @@  discard block
 block discarded – undo
270 270
         return $this->response->getResponseBody();
271 271
     }
272 272
     
273
-   /**
274
-    * Retrieves the request's body content. This is an alias
275
-    * for {@see RequestHelper::getMimeBody()}.
276
-    * 
277
-    * @return string
278
-    * @see RequestHelper::getMimeBody()
279
-    */
273
+    /**
274
+     * Retrieves the request's body content. This is an alias
275
+     * for {@see RequestHelper::getMimeBody()}.
276
+     * 
277
+     * @return string
278
+     * @see RequestHelper::getMimeBody()
279
+     */
280 280
     public function getBody() : string
281 281
     {
282 282
         return $this->getMimeBody();
283 283
     }
284 284
     
285
-   /**
286
-    * Creates a new CURL resource configured according to the
287
-    * request's settings.
288
-    * 
289
-    * @param URLInfo $url
290
-    * @throws RequestHelper_Exception
291
-    * @return resource
292
-    */
285
+    /**
286
+     * Creates a new CURL resource configured according to the
287
+     * request's settings.
288
+     * 
289
+     * @param URLInfo $url
290
+     * @throws RequestHelper_Exception
291
+     * @return resource
292
+     */
293 293
     protected function createCURL(URLInfo $url)
294 294
     {
295 295
         $ch = curl_init();
@@ -337,10 +337,10 @@  discard block
 block discarded – undo
337 337
         return $ch;
338 338
     }
339 339
     
340
-   /**
341
-    * @param resource $ch
342
-    * @return bool Whether logging is enabled.
343
-    */
340
+    /**
341
+     * @param resource $ch
342
+     * @return bool Whether logging is enabled.
343
+     */
344 344
     protected function configureLogging($ch) : bool
345 345
     {
346 346
         if(empty($this->logfile))
@@ -367,13 +367,13 @@  discard block
 block discarded – undo
367 367
         return true;
368 368
     }
369 369
 
370
-   /**
371
-    * Compiles the associative headers array into
372
-    * the format understood by CURL, namely an indexed
373
-    * array with one header string per entry.
374
-    * 
375
-    * @return array
376
-    */
370
+    /**
371
+     * Compiles the associative headers array into
372
+     * the format understood by CURL, namely an indexed
373
+     * array with one header string per entry.
374
+     * 
375
+     * @return array
376
+     */
377 377
     protected function renderHeaders() : array
378 378
     {
379 379
         $result = array();
@@ -387,12 +387,12 @@  discard block
 block discarded – undo
387 387
         return $result;
388 388
     }
389 389
     
390
-   /**
391
-    * Retrieves the raw response header, in the form of an indexed
392
-    * array containing all response header lines.
393
-    * 
394
-    * @return array
395
-    */
390
+    /**
391
+     * Retrieves the raw response header, in the form of an indexed
392
+     * array containing all response header lines.
393
+     * 
394
+     * @return array
395
+     */
396 396
     public function getResponseHeader() : array
397 397
     {
398 398
         $response = $this->getResponse();
@@ -404,33 +404,33 @@  discard block
 block discarded – undo
404 404
         return array();
405 405
     }
406 406
 
407
-   /**
408
-    * After calling the {@link send()} method, this may be used to
409
-    * retrieve the response text from the POST request.
410
-    *
411
-    * @return RequestHelper_Response|NULL
412
-    */
407
+    /**
408
+     * After calling the {@link send()} method, this may be used to
409
+     * retrieve the response text from the POST request.
410
+     *
411
+     * @return RequestHelper_Response|NULL
412
+     */
413 413
     public function getResponse() : ?RequestHelper_Response
414 414
     {
415 415
         return $this->response;
416 416
     }
417 417
     
418
-   /**
419
-    * Retrieves all headers set until now.
420
-    * 
421
-    * @return array<string,string>
422
-    */
418
+    /**
419
+     * Retrieves all headers set until now.
420
+     * 
421
+     * @return array<string,string>
422
+     */
423 423
     public function getHeaders() : array
424 424
     {
425 425
         return $this->headers;
426 426
     }
427 427
     
428
-   /**
429
-    * Retrieves the value of a header by its name.
430
-    * 
431
-    * @param string $name
432
-    * @return string The header value, or an empty string if not set.
433
-    */
428
+    /**
429
+     * Retrieves the value of a header by its name.
430
+     * 
431
+     * @param string $name
432
+     * @return string The header value, or an empty string if not set.
433
+     */
434 434
     public function getHeader(string $name) : string
435 435
     {
436 436
         if(isset($this->headers[$name]))
Please login to merge, or discard this patch.
src/Highlighter.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     */
109 109
     public static function json($subject) : string
110 110
     {
111
-        if(!is_string($subject))
111
+        if (!is_string($subject))
112 112
         {
113 113
             $subject = json_encode($subject, JSON_PRETTY_PRINT);
114 114
         }
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
     * @param bool $formatSource Whether to format the source with indentation to make it readable.
126 126
     * @return string
127 127
     */
128
-    public static function xml(string $xml, bool $formatSource=false) : string
128
+    public static function xml(string $xml, bool $formatSource = false) : string
129 129
     {
130
-        if($formatSource)
130
+        if ($formatSource)
131 131
         {
132 132
             $dom = new DOMDocument();
133 133
             $dom->preserveWhiteSpace = false;
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
     * @param bool $formatSource
149 149
     * @return string
150 150
     */
151
-    public static function html(string $html, bool $formatSource=false) : string
151
+    public static function html(string $html, bool $formatSource = false) : string
152 152
     {
153
-        if($formatSource)
153
+        if ($formatSource)
154 154
         {
155 155
             $dom = new DOMDocument();
156 156
             $dom->preserveWhiteSpace = false;
Please login to merge, or discard this patch.
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -41,71 +41,71 @@  discard block
 block discarded – undo
41 41
  */
42 42
 class Highlighter
43 43
 {
44
-   /**
45
-    * Creates a new GeSHi instance from a source code string.
46
-    * 
47
-    * @param string $sourceCode
48
-    * @param string $format
49
-    * @return GeSHi
50
-    */
44
+    /**
45
+     * Creates a new GeSHi instance from a source code string.
46
+     * 
47
+     * @param string $sourceCode
48
+     * @param string $format
49
+     * @return GeSHi
50
+     */
51 51
     public static function fromString(string $sourceCode, string $format) : GeSHi
52 52
     {
53 53
         return new GeSHi($sourceCode, $format);
54 54
     }
55 55
     
56
-   /**
57
-    * Creates a new GeSHi instance from the contents of a file.
58
-    * 
59
-    * @param string $path
60
-    * @param string $format
61
-    * @return GeSHi
62
-    */
56
+    /**
57
+     * Creates a new GeSHi instance from the contents of a file.
58
+     * 
59
+     * @param string $path
60
+     * @param string $format
61
+     * @return GeSHi
62
+     */
63 63
     public static function fromFile(string $path, string $format) : GeSHi
64 64
     {
65 65
         return self::fromString(FileHelper::readContents($path), $format);
66 66
     }
67 67
     
68
-   /**
69
-    * Parses and highlights the target string.
70
-    * 
71
-    * @param string $sourceCode
72
-    * @param string $format
73
-    * @return string
74
-    */
68
+    /**
69
+     * Parses and highlights the target string.
70
+     * 
71
+     * @param string $sourceCode
72
+     * @param string $format
73
+     * @return string
74
+     */
75 75
     public static function parseString(string $sourceCode, string $format) : string
76 76
     {
77 77
         return self::fromString($sourceCode, $format)->parse_code();
78 78
     }
79 79
     
80
-   /**
81
-    * Parses and highlights the contents of the target file.
82
-    * 
83
-    * @param string $path
84
-    * @param string $format
85
-    * @return string
86
-    */
80
+    /**
81
+     * Parses and highlights the contents of the target file.
82
+     * 
83
+     * @param string $path
84
+     * @param string $format
85
+     * @return string
86
+     */
87 87
     public static function parseFile(string $path, string $format) : string
88 88
     {
89 89
         return self::fromFile($path, $format)->parse_code();
90 90
     }
91 91
     
92
-   /**
93
-    * Adds HTML syntax highlighting to the specified SQL string.
94
-    *
95
-    * @param string $sql
96
-    * @return string
97
-    */
92
+    /**
93
+     * Adds HTML syntax highlighting to the specified SQL string.
94
+     *
95
+     * @param string $sql
96
+     * @return string
97
+     */
98 98
     public static function sql(string $sql) : string
99 99
     {
100 100
         return self::parseString($sql, 'sql');
101 101
     }
102 102
     
103
-   /**
104
-    * Adds HTML syntax highlighting to a JSON string, or a data array/object.
105
-    *
106
-    * @param array<int|string,mixed>|object|string $subject A JSON string, or data array/object to convert to JSON to highlight.
107
-    * @return string
108
-    */
103
+    /**
104
+     * Adds HTML syntax highlighting to a JSON string, or a data array/object.
105
+     *
106
+     * @param array<int|string,mixed>|object|string $subject A JSON string, or data array/object to convert to JSON to highlight.
107
+     * @return string
108
+     */
109 109
     public static function json($subject) : string
110 110
     {
111 111
         if(!is_string($subject))
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
         return self::parseString($subject, 'javascript');
119 119
     }
120 120
     
121
-   /**
122
-    * Adds HTML syntax highlighting to the specified XML code.
123
-    *
124
-    * @param string $xml The XML to highlight.
125
-    * @param bool $formatSource Whether to format the source with indentation to make it readable.
126
-    * @return string
127
-    */
121
+    /**
122
+     * Adds HTML syntax highlighting to the specified XML code.
123
+     *
124
+     * @param string $xml The XML to highlight.
125
+     * @param bool $formatSource Whether to format the source with indentation to make it readable.
126
+     * @return string
127
+     */
128 128
     public static function xml(string $xml, bool $formatSource=false) : string
129 129
     {
130 130
         if($formatSource)
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
         return self::parseString($xml, 'xml');
142 142
     }
143 143
     
144
-   /**
145
-    * Adds HTML syntax highlighting to the specified HTML code.
146
-    * 
147
-    * @param string $html
148
-    * @param bool $formatSource
149
-    * @return string
150
-    */
144
+    /**
145
+     * Adds HTML syntax highlighting to the specified HTML code.
146
+     * 
147
+     * @param string $html
148
+     * @param bool $formatSource
149
+     * @return string
150
+     */
151 151
     public static function html(string $html, bool $formatSource=false) : string
152 152
     {
153 153
         if($formatSource)
@@ -164,27 +164,27 @@  discard block
 block discarded – undo
164 164
         return self::parseString($html, 'xml');
165 165
     }
166 166
     
167
-   /**
168
-    * Adds HTML syntax highlighting to a bit of PHP code.
169
-    * 
170
-    * @param string $phpCode
171
-    * @return string
172
-    */
167
+    /**
168
+     * Adds HTML syntax highlighting to a bit of PHP code.
169
+     * 
170
+     * @param string $phpCode
171
+     * @return string
172
+     */
173 173
     public static function php(string $phpCode) : string
174 174
     {
175 175
         return self::parseString($phpCode, 'php');
176 176
     }
177 177
     
178
-   /**
179
-    * Adds HTML syntax highlighting to an URL.
180
-    *
181
-    * NOTE: Includes the necessary CSS styles. When
182
-    * highlighting several URLs in the same page,
183
-    * prefer using the `parseURL` function instead.
184
-    *
185
-    * @param string $url
186
-    * @return string
187
-    */
178
+    /**
179
+     * Adds HTML syntax highlighting to an URL.
180
+     *
181
+     * NOTE: Includes the necessary CSS styles. When
182
+     * highlighting several URLs in the same page,
183
+     * prefer using the `parseURL` function instead.
184
+     *
185
+     * @param string $url
186
+     * @return string
187
+     */
188 188
     public static function url(string $url) : string
189 189
     {
190 190
         $info = parseURL($url);
Please login to merge, or discard this patch.