Passed
Push — master ( 1f0193...943848 )
by Sebastian
03:12
created
src/OperationResult/Collection.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
  */
27 27
 class OperationResult_Collection extends OperationResult
28 28
 {
29
-   /**
30
-    * @var OperationResult[]
31
-    */
29
+    /**
30
+     * @var OperationResult[]
31
+     */
32 32
     protected $results = array();
33 33
     
34 34
     public function makeError(string $message, int $code=0) : OperationResult
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
         return $this;
107 107
     }
108 108
     
109
-   /**
110
-    * @return OperationResult[]
111
-    */
109
+    /**
110
+     * @return OperationResult[]
111
+     */
112 112
     public function getResults() : array
113 113
     {
114 114
         return $this->results;
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -31,27 +31,27 @@  discard block
 block discarded – undo
31 31
     */
32 32
     protected $results = array();
33 33
     
34
-    public function makeError(string $message, int $code=0) : OperationResult
34
+    public function makeError(string $message, int $code = 0) : OperationResult
35 35
     {
36 36
         return $this->add('makeError', $message, $code);
37 37
     }
38 38
     
39
-    public function makeSuccess(string $message, int $code=0) : OperationResult
39
+    public function makeSuccess(string $message, int $code = 0) : OperationResult
40 40
     {
41 41
         return $this->add('makeSuccess', $message, $code);
42 42
     }
43 43
 
44
-    public function makeWarning(string $message, int $code=0) : OperationResult
44
+    public function makeWarning(string $message, int $code = 0) : OperationResult
45 45
     {
46 46
         return $this->add('makeWarning', $message, $code);
47 47
     }
48 48
     
49
-    public function makeNotice(string $message, int $code=0) : OperationResult
49
+    public function makeNotice(string $message, int $code = 0) : OperationResult
50 50
     {
51 51
         return $this->add('makeNotice', $message, $code);
52 52
     }
53 53
     
54
-    protected function add(string $method, string $message, int $code=0) : OperationResult
54
+    protected function add(string $method, string $message, int $code = 0) : OperationResult
55 55
     {
56 56
         $result = new OperationResult($this->subject);
57 57
         $result->$method($message, $code);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     
64 64
     public function addResult(OperationResult $result) : OperationResult_Collection
65 65
     {
66
-        if($result instanceof OperationResult_Collection)
66
+        if ($result instanceof OperationResult_Collection)
67 67
         {
68 68
             return $this->importCollection($result);
69 69
         }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     {
76 76
         $results = $collection->getResults();
77 77
         
78
-        foreach($results as $result)
78
+        foreach ($results as $result)
79 79
         {
80 80
             $this->addResult($result);
81 81
         }
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
     
112 112
     public function isValid() : bool
113 113
     {
114
-        foreach($this->results as $result)
114
+        foreach ($this->results as $result)
115 115
         {
116
-            if(!$result->isValid())
116
+            if (!$result->isValid())
117 117
             {
118 118
                 return false;
119 119
             }
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
     
125 125
     public function hasCode() : bool
126 126
     {
127
-        foreach($this->results as $result)
127
+        foreach ($this->results as $result)
128 128
         {
129
-            if($result->hasCode())
129
+            if ($result->hasCode())
130 130
             {
131 131
                 return true;
132 132
             }
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
     
138 138
     public function getCode() : int
139 139
     {
140
-        foreach($this->results as $result)
140
+        foreach ($this->results as $result)
141 141
         {
142
-            if($result->hasCode())
142
+            if ($result->hasCode())
143 143
             {
144 144
                 return $result->getCode();
145 145
             }
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
         return 0;
149 149
     }
150 150
     
151
-    public function getMessage(string $type='') : string
151
+    public function getMessage(string $type = '') : string
152 152
     {
153
-        foreach($this->results as $result)
153
+        foreach ($this->results as $result)
154 154
         {
155 155
             $msg = $result->getMessage($type);
156 156
             
157
-            if(!empty($msg))
157
+            if (!empty($msg))
158 158
             {
159 159
                 return $msg;
160 160
             }
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
     
166 166
     public function containsCode(int $code) : bool
167 167
     {
168
-        foreach($this->results as $result)
168
+        foreach ($this->results as $result)
169 169
         {
170
-            if($result->getCode() === $code)
170
+            if ($result->getCode() === $code)
171 171
             {
172 172
                 return true;
173 173
             }
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
     {
201 201
         $amount = 0;
202 202
         
203
-        foreach($this->results as $result)
203
+        foreach ($this->results as $result)
204 204
         {
205
-            if($result->isType($type))
205
+            if ($result->isType($type))
206 206
             {
207 207
                 $amount++;
208 208
             }
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
     {
241 241
         $results = array();
242 242
         
243
-        foreach($this->results as $result)
243
+        foreach ($this->results as $result)
244 244
         {
245
-            if($result->isType($type))
245
+            if ($result->isType($type))
246 246
             {
247 247
                 $results[] = $result;
248 248
             }
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
     
254 254
     public function isType(string $type) : bool
255 255
     {
256
-        foreach($this->results as $result)
256
+        foreach ($this->results as $result)
257 257
         {
258
-            if($result->isType($type))
258
+            if ($result->isType($type))
259 259
             {
260 260
                 return true;
261 261
             }
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
         $lines[] = 'Collection #'.$this->getID();
272 272
         $lines[] = 'Subject: '.get_class($this->subject);
273 273
         
274
-        foreach($this->results as $result)
274
+        foreach ($this->results as $result)
275 275
         {
276 276
             $lines[] = ' - '.$result->getType().' #'.$result->getCode().' "'.$result->getMessage($result->getType()).'"';
277 277
         }
Please login to merge, or discard this patch.
src/Traits/Classable.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
  */
26 26
 trait Traits_Classable
27 27
 {
28
-   /**
29
-    * @var string[]
30
-    */
28
+    /**
29
+     * @var string[]
30
+     */
31 31
     protected $classes = array();
32 32
     
33 33
     public function addClass(string $name)
@@ -65,30 +65,30 @@  discard block
 block discarded – undo
65 65
         return $this;
66 66
     }
67 67
     
68
-   /**
69
-    * Retrieves a list of all classes, if any.
70
-    * 
71
-    * @return string[]
72
-    */
68
+    /**
69
+     * Retrieves a list of all classes, if any.
70
+     * 
71
+     * @return string[]
72
+     */
73 73
     public function getClasses() : array
74 74
     {
75 75
         return $this->classes;
76 76
     }
77 77
     
78
-   /**
79
-    * Renders the class names list as space-separated string for use in an HTML tag.
80
-    * 
81
-    * @return string
82
-    */
78
+    /**
79
+     * Renders the class names list as space-separated string for use in an HTML tag.
80
+     * 
81
+     * @return string
82
+     */
83 83
     public function classesToString() : string
84 84
     {
85 85
         return implode(' ', $this->classes);
86 86
     }
87 87
     
88
-   /**
89
-    * Renders the "class" attribute string for inserting into an HTML tag.
90
-    * @return string
91
-    */
88
+    /**
89
+     * Renders the "class" attribute string for inserting into an HTML tag.
90
+     * @return string
91
+     */
92 92
     public function classesToAttribute() : string
93 93
     {
94 94
         if(!empty($this->classes))
@@ -117,42 +117,42 @@  discard block
 block discarded – undo
117 117
  */
118 118
 interface Interface_Classable
119 119
 {
120
-   /**
121
-    * @param string $name
122
-    * @return $this
123
-    */
120
+    /**
121
+     * @param string $name
122
+     * @return $this
123
+     */
124 124
     public function addClass(string $name);
125 125
 
126
-   /**
127
-    * @param array $names
128
-    * @return $this
129
-    */
126
+    /**
127
+     * @param array $names
128
+     * @return $this
129
+     */
130 130
     public function addClasses(array $names);
131 131
     
132
-   /**
133
-    * @param string $name
134
-    * @return bool
135
-    */
132
+    /**
133
+     * @param string $name
134
+     * @return bool
135
+     */
136 136
     public function hasClass(string $name) : bool;
137 137
     
138
-   /**
139
-    * @param string $name
140
-    * @return $this
141
-    */
138
+    /**
139
+     * @param string $name
140
+     * @return $this
141
+     */
142 142
     public function removeClass(string $name);
143 143
     
144
-   /**
145
-    * @return array
146
-    */
144
+    /**
145
+     * @return array
146
+     */
147 147
     public function getClasses() : array;
148 148
     
149
-   /**
150
-    * @return string
151
-    */
149
+    /**
150
+     * @return string
151
+     */
152 152
     public function classesToString() : string;
153 153
     
154
-   /**
155
-    * @return string
156
-    */
154
+    /**
155
+     * @return string
156
+     */
157 157
     public function classesToAttribute() : string;
158 158
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     
33 33
     public function addClass(string $name)
34 34
     {
35
-        if(!in_array($name, $this->classes)) {
35
+        if (!in_array($name, $this->classes)) {
36 36
             $this->classes[] = $name;
37 37
         }
38 38
         
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     
42 42
     public function addClasses(array $names)
43 43
     {
44
-        foreach($names as $name) {
44
+        foreach ($names as $name) {
45 45
             $this->addClass($name);
46 46
         }
47 47
         
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     {
58 58
         $idx = array_search($name, $this->classes);
59 59
         
60
-        if($idx !== false) {
60
+        if ($idx !== false) {
61 61
             unset($this->classes[$idx]);
62 62
             sort($this->classes);
63 63
         }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     */
92 92
     public function classesToAttribute() : string
93 93
     {
94
-        if(!empty($this->classes))
94
+        if (!empty($this->classes))
95 95
         {
96 96
             return sprintf(
97 97
                 ' class="%s" ',
Please login to merge, or discard this patch.
src/ConvertHelper/URLFinder.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -24,19 +24,19 @@  discard block
 block discarded – undo
24 24
 {
25 25
     use Traits_Optionable;
26 26
     
27
-   /**
28
-    * @see https://gist.github.com/gruber/249502
29
-    */
27
+    /**
28
+     * @see https://gist.github.com/gruber/249502
29
+     */
30 30
     const REGEX_URL = '#(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“”‘’]))#i';
31 31
     
32
-   /**
33
-    * @var string
34
-    */
32
+    /**
33
+     * @var string
34
+     */
35 35
     protected $subject;
36 36
 
37
-   /**
38
-    * @var string[]
39
-    */
37
+    /**
38
+     * @var string[]
39
+     */
40 40
     protected $schemes = array(
41 41
         'http',
42 42
         'https',
@@ -62,49 +62,49 @@  discard block
 block discarded – undo
62 62
         );
63 63
     }
64 64
     
65
-   /**
66
-    * Whether to enable sorting the URLs alphabetically (disabled by default).
67
-    * 
68
-    * @param bool $enabled
69
-    * @return ConvertHelper_URLFinder
70
-    */
65
+    /**
66
+     * Whether to enable sorting the URLs alphabetically (disabled by default).
67
+     * 
68
+     * @param bool $enabled
69
+     * @return ConvertHelper_URLFinder
70
+     */
71 71
     public function enableSorting(bool $enabled=true) : ConvertHelper_URLFinder
72 72
     {
73 73
         $this->setOption('sorting', $enabled);
74 74
         return $this;
75 75
     }
76 76
     
77
-   /**
78
-    * Whether to include email addresses in the search. 
79
-    * This is only relevant when using the getURLs()
80
-    * method.
81
-    * 
82
-    * @param bool $include
83
-    * @return ConvertHelper_URLFinder
84
-    */
77
+    /**
78
+     * Whether to include email addresses in the search. 
79
+     * This is only relevant when using the getURLs()
80
+     * method.
81
+     * 
82
+     * @param bool $include
83
+     * @return ConvertHelper_URLFinder
84
+     */
85 85
     public function includeEmails(bool $include=true) : ConvertHelper_URLFinder
86 86
     {
87 87
         $this->setOption('include-emails', $include);
88 88
         return $this;
89 89
     }
90 90
     
91
-   /**
92
-    * Whether to omit the mailto: that is automatically added to all email addresses.
93
-    * 
94
-    * @param bool $omit
95
-    * @return ConvertHelper_URLFinder
96
-    */
91
+    /**
92
+     * Whether to omit the mailto: that is automatically added to all email addresses.
93
+     * 
94
+     * @param bool $omit
95
+     * @return ConvertHelper_URLFinder
96
+     */
97 97
     public function omitMailto(bool $omit=true) : ConvertHelper_URLFinder
98 98
     {
99 99
         $this->setOption('omit-mailto', $omit);
100 100
         return $this;
101 101
     }
102 102
     
103
-   /**
104
-    * Prepares the subject string by adding a newline before all URL schemes,
105
-    * to make it possible to parse even lists of links separated by commas or
106
-    * the like (http://domain.com,http://domain2.com).
107
-    */
103
+    /**
104
+     * Prepares the subject string by adding a newline before all URL schemes,
105
+     * to make it possible to parse even lists of links separated by commas or
106
+     * the like (http://domain.com,http://domain2.com).
107
+     */
108 108
     private function prepareSubject() : void
109 109
     {
110 110
         $replaces = array();
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
         $this->subject = str_replace(array_keys($replaces), array_values($replaces), $this->subject);
118 118
     }
119 119
     
120
-   /**
121
-    * Fetches all URLs that can be found in the subject string.
122
-    * 
123
-    * @return string[]
124
-    */
120
+    /**
121
+     * Fetches all URLs that can be found in the subject string.
122
+     * 
123
+     * @return string[]
124
+     */
125 125
     public function getURLs() : array
126 126
     {
127 127
         $this->prepareSubject();
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
         return $result;
155 155
     }
156 156
     
157
-   /**
158
-    * Retrieves all email addresses from the subject string.
159
-    * 
160
-    * @return string[]
161
-    * 
162
-    * @see omitMailto()
163
-    */
157
+    /**
158
+     * Retrieves all email addresses from the subject string.
159
+     * 
160
+     * @return string[]
161
+     * 
162
+     * @see omitMailto()
163
+     */
164 164
     public function getEmails() : array
165 165
     {
166 166
         $matches = array();
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
         return 'mailto:';
195 195
     }
196 196
     
197
-   /**
198
-    * Retrieves all URLs as URLInfo instances.
199
-    * 
200
-    * @return URLInfo[]
201
-    */
197
+    /**
198
+     * Retrieves all URLs as URLInfo instances.
199
+     * 
200
+     * @return URLInfo[]
201
+     */
202 202
     public function getInfos()
203 203
     {
204 204
         $urls = $this->getURLs();
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     * @param bool $enabled
69 69
     * @return ConvertHelper_URLFinder
70 70
     */
71
-    public function enableSorting(bool $enabled=true) : ConvertHelper_URLFinder
71
+    public function enableSorting(bool $enabled = true) : ConvertHelper_URLFinder
72 72
     {
73 73
         $this->setOption('sorting', $enabled);
74 74
         return $this;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     * @param bool $include
83 83
     * @return ConvertHelper_URLFinder
84 84
     */
85
-    public function includeEmails(bool $include=true) : ConvertHelper_URLFinder
85
+    public function includeEmails(bool $include = true) : ConvertHelper_URLFinder
86 86
     {
87 87
         $this->setOption('include-emails', $include);
88 88
         return $this;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     * @param bool $omit
95 95
     * @return ConvertHelper_URLFinder
96 96
     */
97
-    public function omitMailto(bool $omit=true) : ConvertHelper_URLFinder
97
+    public function omitMailto(bool $omit = true) : ConvertHelper_URLFinder
98 98
     {
99 99
         $this->setOption('omit-mailto', $omit);
100 100
         return $this;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     {
110 110
         $replaces = array();
111 111
         
112
-        foreach($this->schemes as $scheme)
112
+        foreach ($this->schemes as $scheme)
113 113
         {
114 114
             $replaces[$scheme.':'] = PHP_EOL.$scheme.':';
115 115
         }
@@ -131,20 +131,20 @@  discard block
 block discarded – undo
131 131
         
132 132
         $result = array();
133 133
         
134
-        foreach($matches[0] as $match)
134
+        foreach ($matches[0] as $match)
135 135
         {
136
-            if(strstr($match, '://') && !in_array($match, $result))
136
+            if (strstr($match, '://') && !in_array($match, $result))
137 137
             {
138 138
                 $result[] = $match;
139 139
             }
140 140
         }
141 141
         
142
-        if($this->getBoolOption('include-emails'))
142
+        if ($this->getBoolOption('include-emails'))
143 143
         {
144 144
             $result = array_merge($result, $this->getEmails());
145 145
         }
146 146
         
147
-        if($this->getBoolOption('sorting'))
147
+        if ($this->getBoolOption('sorting'))
148 148
         {
149 149
             usort($result, function(string $a, string $b) {
150 150
                 return strnatcasecmp($a, $b);
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
         $result = array();
170 170
         $prefix = $this->getEmailPrefix();
171 171
         
172
-        foreach($matches[0] as $email)
172
+        foreach ($matches[0] as $email)
173 173
         {
174 174
             $result[] = $prefix.$email;
175 175
         }
176 176
         
177
-        if($this->getBoolOption('sorting'))
177
+        if ($this->getBoolOption('sorting'))
178 178
         {
179 179
             usort($result, function(string $a, string $b) {
180 180
                 return strnatcasecmp($a, $b);
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     
187 187
     private function getEmailPrefix() : string
188 188
     {
189
-        if($this->getBoolOption('omit-mailto'))
189
+        if ($this->getBoolOption('omit-mailto'))
190 190
         {
191 191
             return '';
192 192
         }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         
206 206
         $result = array();
207 207
         
208
-        foreach($urls as $url)
208
+        foreach ($urls as $url)
209 209
         {
210 210
             $result[] = parseURL($url);
211 211
         }
Please login to merge, or discard this patch.
src/Request.php 2 patches
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
      */
40 40
     protected static $instance;
41 41
     
42
-   /**
43
-    * @var string
44
-    */
42
+    /**
43
+     * @var string
44
+     */
45 45
     protected $baseURL = '';
46 46
     
47 47
     public function __construct()
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
         $this->init();
52 52
     }
53 53
     
54
-   /**
55
-    * Can be extended in a subclass, to avoid
56
-    * redefining the constructor.
57
-    */
54
+    /**
55
+     * Can be extended in a subclass, to avoid
56
+     * redefining the constructor.
57
+     */
58 58
     protected function init()
59 59
     {
60 60
         
@@ -126,30 +126,30 @@  discard block
 block discarded – undo
126 126
         return $this->buildURL($params, $dispatcher);
127 127
     }
128 128
     
129
-   /**
130
-    * Retrieves the name of the current dispatcher script / page.
131
-    * This is made to be extended and implemented in a subclass.
132
-    * 
133
-    * @return string
134
-    */
129
+    /**
130
+     * Retrieves the name of the current dispatcher script / page.
131
+     * This is made to be extended and implemented in a subclass.
132
+     * 
133
+     * @return string
134
+     */
135 135
     public function getDispatcher() : string
136 136
     {
137 137
         return '';
138 138
     }
139 139
     
140
-   /**
141
-    * Filters and retrieves the current request variables 
142
-    * to be used to build an URL to refresh the current page.
143
-    * 
144
-    * For further customization options, use the 
145
-    * {@see Request::createRefreshParams()} method.
146
-    * 
147
-    * @param array<string,mixed> $params Key => value pairs of parameters to always include in the result.
148
-    * @param string[] $exclude Names of parameters to exclude from the result.
149
-    * @return array<string,mixed>
150
-    * 
151
-    * @see Request::createRefreshParams()
152
-    */
140
+    /**
141
+     * Filters and retrieves the current request variables 
142
+     * to be used to build an URL to refresh the current page.
143
+     * 
144
+     * For further customization options, use the 
145
+     * {@see Request::createRefreshParams()} method.
146
+     * 
147
+     * @param array<string,mixed> $params Key => value pairs of parameters to always include in the result.
148
+     * @param string[] $exclude Names of parameters to exclude from the result.
149
+     * @return array<string,mixed>
150
+     * 
151
+     * @see Request::createRefreshParams()
152
+     */
153 153
     public function getRefreshParams(array $params = array(), array $exclude = array())
154 154
     {
155 155
         return $this->createRefreshParams()
@@ -158,13 +158,13 @@  discard block
 block discarded – undo
158 158
         ->getParams();
159 159
     }
160 160
     
161
-   /**
162
-    * Creates an instance of the helper that can be used to
163
-    * retrieve the request's parameters collection, with the
164
-    * possiblity to exlude and override some by rules.
165
-    * 
166
-    * @return Request_RefreshParams
167
-    */
161
+    /**
162
+     * Creates an instance of the helper that can be used to
163
+     * retrieve the request's parameters collection, with the
164
+     * possiblity to exlude and override some by rules.
165
+     * 
166
+     * @return Request_RefreshParams
167
+     */
168 168
     public function createRefreshParams() : Request_RefreshParams
169 169
     {
170 170
         return new Request_RefreshParams();
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
         return $url;
198 198
     }
199 199
     
200
-   /**
201
-    * Retrieves the base URL of the application.
202
-    * @return string
203
-    */
200
+    /**
201
+     * Retrieves the base URL of the application.
202
+     * @return string
203
+     */
204 204
     public function getBaseURL() : string
205 205
     {
206 206
         return $this->baseURL;
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
         return $this->knownParams[$name];
231 231
     }
232 232
     
233
-   /**
234
-    * Retrieves a previously registered parameter instance.
235
-    * 
236
-    * @param string $name
237
-    * @throws Request_Exception
238
-    * @return Request_Param
239
-    */
233
+    /**
234
+     * Retrieves a previously registered parameter instance.
235
+     * 
236
+     * @param string $name
237
+     * @throws Request_Exception
238
+     * @return Request_Param
239
+     */
240 240
     public function getRegisteredParam(string $name) : Request_Param
241 241
     {
242 242
         if(isset($this->knownParams[$name])) {
@@ -253,48 +253,48 @@  discard block
 block discarded – undo
253 253
         );
254 254
     }
255 255
     
256
-   /**
257
-    * Checks whether a parameter with the specified name 
258
-    * has been registered.
259
-    * 
260
-    * @param string $name
261
-    * @return bool
262
-    */
256
+    /**
257
+     * Checks whether a parameter with the specified name 
258
+     * has been registered.
259
+     * 
260
+     * @param string $name
261
+     * @return bool
262
+     */
263 263
     public function hasRegisteredParam(string $name) : bool
264 264
     {
265 265
         return isset($this->knownParams[$name]);
266 266
     }
267 267
     
268
-   /**
269
-    * Retrieves an indexed array with accept mime types
270
-    * that the client sent, in the order of preference
271
-    * the client specified.
272
-    *
273
-    * Example:
274
-    *
275
-    * array(
276
-    *     'text/html',
277
-    *     'application/xhtml+xml',
278
-    *     'image/webp'
279
-    *     ...
280
-    * )
281
-    * 
282
-    * @return array
283
-    * @see Request::parseAcceptHeaders()
284
-    */
268
+    /**
269
+     * Retrieves an indexed array with accept mime types
270
+     * that the client sent, in the order of preference
271
+     * the client specified.
272
+     *
273
+     * Example:
274
+     *
275
+     * array(
276
+     *     'text/html',
277
+     *     'application/xhtml+xml',
278
+     *     'image/webp'
279
+     *     ...
280
+     * )
281
+     * 
282
+     * @return array
283
+     * @see Request::parseAcceptHeaders()
284
+     */
285 285
     public static function getAcceptHeaders() : array
286 286
     {
287 287
         return self::parseAcceptHeaders()->getMimeStrings();
288 288
     }
289 289
     
290
-   /**
291
-    * Returns an instance of the accept headers parser,
292
-    * to access information on the browser's accepted
293
-    * mime types.
294
-    *  
295
-    * @return Request_AcceptHeaders
296
-    * @see Request::getAcceptHeaders()
297
-    */
290
+    /**
291
+     * Returns an instance of the accept headers parser,
292
+     * to access information on the browser's accepted
293
+     * mime types.
294
+     *  
295
+     * @return Request_AcceptHeaders
296
+     * @see Request::getAcceptHeaders()
297
+     */
298 298
     public static function parseAcceptHeaders() : Request_AcceptHeaders
299 299
     {
300 300
         static $accept;
@@ -342,14 +342,14 @@  discard block
 block discarded – undo
342 342
         return false;
343 343
     }
344 344
     
345
-   /**
346
-    * Removes a single parameter from the request.
347
-    * If the parameter has been registered, also
348
-    * removes the registration info.
349
-    * 
350
-    * @param string $name
351
-    * @return Request
352
-    */
345
+    /**
346
+     * Removes a single parameter from the request.
347
+     * If the parameter has been registered, also
348
+     * removes the registration info.
349
+     * 
350
+     * @param string $name
351
+     * @return Request
352
+     */
353 353
     public function removeParam(string $name) : Request
354 354
     {
355 355
         if(isset($_REQUEST[$name])) {
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
         return $this;
364 364
     }
365 365
     
366
-   /**
367
-    * Removes several parameters from the request.
368
-    * 
369
-    * @param string[] $names
370
-    * @return Request
371
-    */
366
+    /**
367
+     * Removes several parameters from the request.
368
+     * 
369
+     * @param string[] $names
370
+     * @return Request
371
+     */
372 372
     public function removeParams(array $names) : Request
373 373
     {
374 374
         foreach($names as $name) {
@@ -435,18 +435,18 @@  discard block
 block discarded – undo
435 435
         return $val;
436 436
     }
437 437
     
438
-   /**
439
-    * Treats the request parameter as a JSON string, and
440
-    * if it exists and contains valid JSON, returns the
441
-    * decoded JSON value as an array (default).
442
-    *
443
-    * @param string $name
444
-    * @param bool $assoc
445
-    * @return array|object
446
-    * 
447
-    * @see Request::getJSONAssoc()
448
-    * @see Request::getJSONObject()
449
-    */
438
+    /**
439
+     * Treats the request parameter as a JSON string, and
440
+     * if it exists and contains valid JSON, returns the
441
+     * decoded JSON value as an array (default).
442
+     *
443
+     * @param string $name
444
+     * @param bool $assoc
445
+     * @return array|object
446
+     * 
447
+     * @see Request::getJSONAssoc()
448
+     * @see Request::getJSONObject()
449
+     */
450 450
     public function getJSON(string $name, bool $assoc=true)
451 451
     {
452 452
         $value = $this->getParam($name);
@@ -471,13 +471,13 @@  discard block
 block discarded – undo
471 471
         return new \stdClass();
472 472
     }
473 473
     
474
-   /**
475
-    * Like {@link Request::getJSON()}, but omitting the second
476
-    * parameter. Use this for more readable code.
477
-    * 
478
-    * @param string $name
479
-    * @return array
480
-    */
474
+    /**
475
+     * Like {@link Request::getJSON()}, but omitting the second
476
+     * parameter. Use this for more readable code.
477
+     * 
478
+     * @param string $name
479
+     * @return array
480
+     */
481 481
     public function getJSONAssoc(string $name) : array
482 482
     {
483 483
         $result = $this->getJSON($name);
@@ -488,13 +488,13 @@  discard block
 block discarded – undo
488 488
         return array();
489 489
     }
490 490
     
491
-   /**
492
-    * Like {@link Request::getJSON()}, but omitting the second
493
-    * parameter. Use this for more readable code.
494
-    *
495
-    * @param string $name
496
-    * @return object
497
-    */
491
+    /**
492
+     * Like {@link Request::getJSON()}, but omitting the second
493
+     * parameter. Use this for more readable code.
494
+     *
495
+     * @param string $name
496
+     * @return object
497
+     */
498 498
     public function getJSONObject(string $name) : object
499 499
     {
500 500
         $result = $this->getJSON($name, false);
@@ -505,12 +505,12 @@  discard block
 block discarded – undo
505 505
         return new \stdClass();
506 506
     }
507 507
     
508
-   /**
509
-    * Sends a JSON response with the correct headers.
510
-    *
511
-    * @param array|string $data
512
-    * @param bool $exit Whether to exit the script afterwards.
513
-    */
508
+    /**
509
+     * Sends a JSON response with the correct headers.
510
+     *
511
+     * @param array|string $data
512
+     * @param bool $exit Whether to exit the script afterwards.
513
+     */
514 514
     public static function sendJSON($data, bool $exit=true)
515 515
     {
516 516
         $payload = $data;
@@ -530,12 +530,12 @@  discard block
 block discarded – undo
530 530
         }
531 531
     }
532 532
     
533
-   /**
534
-    * Sends HTML to the browser with the correct headers.
535
-    * 
536
-    * @param string $html
537
-    * @param bool $exit Whether to exit the script afterwards.
538
-    */
533
+    /**
534
+     * Sends HTML to the browser with the correct headers.
535
+     * 
536
+     * @param string $html
537
+     * @param bool $exit Whether to exit the script afterwards.
538
+     */
539 539
     public static function sendHTML(string $html, bool $exit=true)
540 540
     {
541 541
         header('Cache-Control: no-cache, must-revalidate');
@@ -550,16 +550,16 @@  discard block
 block discarded – undo
550 550
         }
551 551
     }
552 552
     
553
-   /**
554
-    * Creates a new instance of the URL comparer, which can check 
555
-    * whether the specified URLs match, regardless of the order in 
556
-    * which the query parameters are, if any.
557
-    * 
558
-    * @param string $sourceURL
559
-    * @param string $targetURL
560
-    * @param array $limitParams Whether to limit the comparison to these specific parameter names (if present)
561
-    * @return Request_URLComparer
562
-    */
553
+    /**
554
+     * Creates a new instance of the URL comparer, which can check 
555
+     * whether the specified URLs match, regardless of the order in 
556
+     * which the query parameters are, if any.
557
+     * 
558
+     * @param string $sourceURL
559
+     * @param string $targetURL
560
+     * @param array $limitParams Whether to limit the comparison to these specific parameter names (if present)
561
+     * @return Request_URLComparer
562
+     */
563 563
     public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams=array()) : Request_URLComparer
564 564
     {
565 565
         $comparer = new Request_URLComparer($this, $sourceURL, $targetURL);
@@ -568,10 +568,10 @@  discard block
 block discarded – undo
568 568
         return $comparer;
569 569
     }
570 570
     
571
-   /**
572
-    * Retrieves the full URL that was used to access the current page.
573
-    * @return string
574
-    */
571
+    /**
572
+     * Retrieves the full URL that was used to access the current page.
573
+     * @return string
574
+     */
575 575
     public function getCurrentURL() : string
576 576
     {
577 577
         return $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
     public function getParam($name, $default = null)
91 91
     {
92 92
         $value = $default;
93
-        if(isset($_REQUEST[$name])) {
93
+        if (isset($_REQUEST[$name])) {
94 94
             $value = $_REQUEST[$name];
95 95
         }
96 96
         
97
-        if(isset($this->knownParams[$name])) {
97
+        if (isset($this->knownParams[$name])) {
98 98
             $value = $this->knownParams[$name]->validate($value);
99 99
         }
100 100
         
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
      * @param string $dispatcher Relative path to script to use for the URL. Append trailing slash if needed.
186 186
      * @return string
187 187
      */
188
-    public function buildURL($params = array(), string $dispatcher='')
188
+    public function buildURL($params = array(), string $dispatcher = '')
189 189
     {
190
-        $url = rtrim($this->getBaseURL(), '/') . '/' . $dispatcher;
190
+        $url = rtrim($this->getBaseURL(), '/').'/'.$dispatcher;
191 191
         
192 192
         // append any leftover parameters to the end of the URL
193 193
         if (!empty($params)) {
194
-            $url .= '?' . http_build_query($params, '', '&amp;');
194
+            $url .= '?'.http_build_query($params, '', '&amp;');
195 195
         }
196 196
         
197 197
         return $url;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      */
223 223
     public function registerParam($name)
224 224
     {
225
-        if(!isset($this->knownParams[$name])) {
225
+        if (!isset($this->knownParams[$name])) {
226 226
             $param = new Request_Param($this, $name);
227 227
             $this->knownParams[$name] = $param;
228 228
         }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     */
240 240
     public function getRegisteredParam(string $name) : Request_Param
241 241
     {
242
-        if(isset($this->knownParams[$name])) {
242
+        if (isset($this->knownParams[$name])) {
243 243
             return $this->knownParams[$name];
244 244
         }
245 245
         
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     {
300 300
         static $accept;
301 301
         
302
-        if(!isset($accept)) {
302
+        if (!isset($accept)) {
303 303
             $accept = new Request_AcceptHeaders();
304 304
         }
305 305
         
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     {
319 319
         $_REQUEST[$name] = $value;
320 320
         
321
-        if(isset($this->knownParams[$name])) {
321
+        if (isset($this->knownParams[$name])) {
322 322
             unset($this->knownParams[$name]);
323 323
         }
324 324
         
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
     */
353 353
     public function removeParam(string $name) : Request
354 354
     {
355
-        if(isset($_REQUEST[$name])) {
355
+        if (isset($_REQUEST[$name])) {
356 356
             unset($_REQUEST[$name]);
357 357
         }
358 358
         
359
-        if(isset($this->knownParams[$name])) {
359
+        if (isset($this->knownParams[$name])) {
360 360
             unset($this->knownParams[$name]);
361 361
         }
362 362
         
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
     */
372 372
     public function removeParams(array $names) : Request
373 373
     {
374
-        foreach($names as $name) {
374
+        foreach ($names as $name) {
375 375
             $this->removeParam($name);
376 376
         }
377 377
         
@@ -387,10 +387,10 @@  discard block
 block discarded – undo
387 387
      * @param string $name
388 388
      * @return bool
389 389
      */
390
-    public function getBool($name, $default=false)
390
+    public function getBool($name, $default = false)
391 391
     {
392 392
         $value = $this->getParam($name, $default);
393
-        if(ConvertHelper::isBoolean($value)) {
393
+        if (ConvertHelper::isBoolean($value)) {
394 394
             return ConvertHelper::string2bool($value);
395 395
         }
396 396
         
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
     
400 400
     public function validate()
401 401
     {
402
-        foreach($this->knownParams as $param) 
402
+        foreach ($this->knownParams as $param) 
403 403
         {
404 404
             $name = $param->getName();
405 405
             
406
-            if($param->isRequired() && !$this->hasParam($name)) 
406
+            if ($param->isRequired() && !$this->hasParam($name)) 
407 407
             {
408 408
                 throw new Request_Exception(
409 409
                     'Missing request parameter '.$name,
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
      * @param mixed $default
426 426
      * @return string
427 427
      */
428
-    public function getFilteredParam($name, $default=null)
428
+    public function getFilteredParam($name, $default = null)
429 429
     {
430 430
         $val = $this->getParam($name, $default);
431
-        if(is_string($val)) {
431
+        if (is_string($val)) {
432 432
             $val = htmlspecialchars(trim(strip_tags($val)), ENT_QUOTES, 'UTF-8');
433 433
         }
434 434
         
@@ -447,24 +447,24 @@  discard block
 block discarded – undo
447 447
     * @see Request::getJSONAssoc()
448 448
     * @see Request::getJSONObject()
449 449
     */
450
-    public function getJSON(string $name, bool $assoc=true)
450
+    public function getJSON(string $name, bool $assoc = true)
451 451
     {
452 452
         $value = $this->getParam($name);
453 453
         
454
-        if(!empty($value) && is_string($value)) 
454
+        if (!empty($value) && is_string($value)) 
455 455
         {
456 456
             $data = json_decode($value, $assoc);
457 457
             
458
-            if($assoc && is_array($data)) {
458
+            if ($assoc && is_array($data)) {
459 459
                 return $data;
460 460
             }
461 461
             
462
-            if(is_object($data)) {
462
+            if (is_object($data)) {
463 463
                 return $data;
464 464
             }
465 465
         }
466 466
         
467
-        if($assoc) {
467
+        if ($assoc) {
468 468
             return array();
469 469
         }
470 470
         
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
     public function getJSONAssoc(string $name) : array
482 482
     {
483 483
         $result = $this->getJSON($name);
484
-        if(is_array($result)) {
484
+        if (is_array($result)) {
485 485
             return $result;
486 486
         }
487 487
         
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
     public function getJSONObject(string $name) : object
499 499
     {
500 500
         $result = $this->getJSON($name, false);
501
-        if(is_object($result)) {
501
+        if (is_object($result)) {
502 502
             return $result;
503 503
         }
504 504
         
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
     * @param array|string $data
512 512
     * @param bool $exit Whether to exit the script afterwards.
513 513
     */
514
-    public static function sendJSON($data, bool $exit=true)
514
+    public static function sendJSON($data, bool $exit = true)
515 515
     {
516 516
         $payload = $data;
517
-        if(!is_string($payload)) {
517
+        if (!is_string($payload)) {
518 518
             $payload = json_encode($payload);
519 519
         }
520 520
         
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
         
525 525
         echo $payload;
526 526
         
527
-        if($exit) 
527
+        if ($exit) 
528 528
         {
529 529
             exit;
530 530
         }
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
     * @param string $html
537 537
     * @param bool $exit Whether to exit the script afterwards.
538 538
     */
539
-    public static function sendHTML(string $html, bool $exit=true)
539
+    public static function sendHTML(string $html, bool $exit = true)
540 540
     {
541 541
         header('Cache-Control: no-cache, must-revalidate');
542 542
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
         
545 545
         echo $html;
546 546
         
547
-        if($exit)
547
+        if ($exit)
548 548
         {
549 549
             exit;
550 550
         }
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
     * @param array $limitParams Whether to limit the comparison to these specific parameter names (if present)
561 561
     * @return Request_URLComparer
562 562
     */
563
-    public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams=array()) : Request_URLComparer
563
+    public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams = array()) : Request_URLComparer
564 564
     {
565 565
         $comparer = new Request_URLComparer($this, $sourceURL, $targetURL);
566 566
         $comparer->addLimitParams($limitParams);
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
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
22 22
 {
23 23
     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.
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.
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/URLInfo.php 2 patches
Indentation   +199 added lines, -199 removed lines patch added patch discarded remove patch
@@ -34,42 +34,42 @@  discard block
 block discarded – undo
34 34
     const TYPE_PHONE = 'phone';
35 35
     const TYPE_URL = 'url';
36 36
     
37
-   /**
38
-    * The original URL that was passed to the constructor.
39
-    * @var string
40
-    */
37
+    /**
38
+     * The original URL that was passed to the constructor.
39
+     * @var string
40
+     */
41 41
     protected $rawURL;
42 42
 
43
-   /**
44
-    * @var array
45
-    */
43
+    /**
44
+     * @var array
45
+     */
46 46
     protected $info;
47 47
     
48
-   /**
49
-    * @var string[]
50
-    */
48
+    /**
49
+     * @var string[]
50
+     */
51 51
     protected $excludedParams = array();
52 52
     
53
-   /**
54
-    * @var bool
55
-    * @see URLInfo::setParamExclusion()
56
-    */
53
+    /**
54
+     * @var bool
55
+     * @see URLInfo::setParamExclusion()
56
+     */
57 57
     protected $paramExclusion = false;
58 58
     
59
-   /**
60
-    * @var array
61
-    * @see URLInfo::getTypeLabel()
62
-    */
59
+    /**
60
+     * @var array
61
+     * @see URLInfo::getTypeLabel()
62
+     */
63 63
     protected static $typeLabels;
64 64
     
65
-   /**
66
-    * @var bool
67
-    */
65
+    /**
66
+     * @var bool
67
+     */
68 68
     protected $highlightExcluded = false;
69 69
     
70
-   /**
71
-    * @var array
72
-    */
70
+    /**
71
+     * @var array
72
+     */
73 73
     protected $infoKeys = array(
74 74
         'scheme',
75 75
         'host',
@@ -81,24 +81,24 @@  discard block
 block discarded – undo
81 81
         'fragment'
82 82
     );
83 83
     
84
-   /**
85
-    * @var string
86
-    */
84
+    /**
85
+     * @var string
86
+     */
87 87
     protected $url;
88 88
     
89
-   /**
90
-    * @var URLInfo_Parser
91
-    */
89
+    /**
90
+     * @var URLInfo_Parser
91
+     */
92 92
     protected $parser;
93 93
     
94
-   /**
95
-    * @var URLInfo_Normalizer
96
-    */
94
+    /**
95
+     * @var URLInfo_Normalizer
96
+     */
97 97
     protected $normalizer;
98 98
     
99
-   /**
100
-    * @var bool
101
-    */
99
+    /**
100
+     * @var bool
101
+     */
102 102
     protected $encodeUTFChars = false;
103 103
     
104 104
     public function __construct(string $url)
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
         $this->info = $this->parser->getInfo();
116 116
     }
117 117
     
118
-   /**
119
-    * Whether to URL encode any non-encoded UTF8 characters in the URL.
120
-    * Default is to leave them as-is for better readability, since 
121
-    * browsers handle this well.
122
-    * 
123
-    * @param bool $enabled
124
-    * @return URLInfo
125
-    */
118
+    /**
119
+     * Whether to URL encode any non-encoded UTF8 characters in the URL.
120
+     * Default is to leave them as-is for better readability, since 
121
+     * browsers handle this well.
122
+     * 
123
+     * @param bool $enabled
124
+     * @return URLInfo
125
+     */
126 126
     public function setUTFEncoding(bool $enabled=true) : URLInfo
127 127
     {
128 128
         if($this->encodeUTFChars !== $enabled)
@@ -139,13 +139,13 @@  discard block
 block discarded – undo
139 139
         return $this->encodeUTFChars;
140 140
     }
141 141
     
142
-   /**
143
-    * Filters an URL: removes control characters and the
144
-    * like to have a clean URL to work with.
145
-    * 
146
-    * @param string $url
147
-    * @return string
148
-    */
142
+    /**
143
+     * Filters an URL: removes control characters and the
144
+     * like to have a clean URL to work with.
145
+     * 
146
+     * @param string $url
147
+     * @return string
148
+     */
149 149
     public static function filterURL(string $url)
150 150
     {
151 151
         return URLInfo_Filter::filter($url);
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
         return $this->info['type'] === self::TYPE_PHONE;
176 176
     }
177 177
     
178
-   /**
179
-    * Whether the URL is a regular URL, not one of the 
180
-    * other types like a phone number or email address.
181
-    * 
182
-    * @return bool
183
-    */
178
+    /**
179
+     * Whether the URL is a regular URL, not one of the 
180
+     * other types like a phone number or email address.
181
+     * 
182
+     * @return bool
183
+     */
184 184
     public function isURL() : bool
185 185
     {
186 186
         $host = $this->getHost();
@@ -192,20 +192,20 @@  discard block
 block discarded – undo
192 192
         return $this->parser->isValid();
193 193
     }
194 194
     
195
-   /**
196
-    * Retrieves the host name, or an empty string if none is present.
197
-    * 
198
-    * @return string
199
-    */
195
+    /**
196
+     * Retrieves the host name, or an empty string if none is present.
197
+     * 
198
+     * @return string
199
+     */
200 200
     public function getHost() : string
201 201
     {
202 202
         return $this->getInfoKey('host');
203 203
     }
204 204
     
205
-   /**
206
-    * Retrieves the path, or an empty string if none is present.
207
-    * @return string
208
-    */
205
+    /**
206
+     * Retrieves the path, or an empty string if none is present.
207
+     * @return string
208
+     */
209 209
     public function getPath() : string
210 210
     {
211 211
         return $this->getInfoKey('path');
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
         return $this->getInfoKey('scheme');
222 222
     }
223 223
     
224
-   /**
225
-    * Retrieves the port specified in the URL, or -1 if none is preseent.
226
-    * @return int
227
-    */
224
+    /**
225
+     * Retrieves the port specified in the URL, or -1 if none is preseent.
226
+     * @return int
227
+     */
228 228
     public function getPort() : int
229 229
     {
230 230
         $port = $this->getInfoKey('port');
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
         return -1;
237 237
     }
238 238
     
239
-   /**
240
-    * Retrieves the raw query string, or an empty string if none is present.
241
-    * 
242
-    * @return string
243
-    * 
244
-    * @see URLInfo::getParams()
245
-    */
239
+    /**
240
+     * Retrieves the raw query string, or an empty string if none is present.
241
+     * 
242
+     * @return string
243
+     * 
244
+     * @see URLInfo::getParams()
245
+     */
246 246
     public function getQuery() : string
247 247
     {
248 248
         return $this->getInfoKey('query');
@@ -258,20 +258,20 @@  discard block
 block discarded – undo
258 258
         return $this->getInfoKey('pass');
259 259
     }
260 260
     
261
-   /**
262
-    * Whether the URL contains a port number.
263
-    * @return bool
264
-    */
261
+    /**
262
+     * Whether the URL contains a port number.
263
+     * @return bool
264
+     */
265 265
     public function hasPort() : bool
266 266
     {
267 267
         return $this->getPort() !== -1;
268 268
     }
269 269
     
270
-   /**
271
-    * Alias for the hasParams() method.
272
-    * @return bool
273
-    * @see URLInfo::hasParams()
274
-    */
270
+    /**
271
+     * Alias for the hasParams() method.
272
+     * @return bool
273
+     * @see URLInfo::hasParams()
274
+     */
275 275
     public function hasQuery() : bool
276 276
     {
277 277
         return $this->hasParams();
@@ -316,23 +316,23 @@  discard block
 block discarded – undo
316 316
         return '';
317 317
     }
318 318
 
319
-   /**
320
-    * Retrieves a normalized URL: this ensures that all parameters
321
-    * in the URL are always in the same order.
322
-    * 
323
-    * @return string
324
-    */
319
+    /**
320
+     * Retrieves a normalized URL: this ensures that all parameters
321
+     * in the URL are always in the same order.
322
+     * 
323
+     * @return string
324
+     */
325 325
     public function getNormalized() : string
326 326
     {
327 327
         return $this->normalize(true);
328 328
     }
329 329
     
330
-   /**
331
-    * Like getNormalized(), but if a username and password are present
332
-    * in the URL, returns the URL without them.
333
-    * 
334
-    * @return string
335
-    */
330
+    /**
331
+     * Like getNormalized(), but if a username and password are present
332
+     * in the URL, returns the URL without them.
333
+     * 
334
+     * @return string
335
+     */
336 336
     public function getNormalizedWithoutAuth() : string
337 337
     {
338 338
         return $this->normalize(false);
@@ -353,25 +353,25 @@  discard block
 block discarded – undo
353 353
         return $this->normalizer->normalize();
354 354
     }
355 355
     
356
-   /**
357
-    * Creates a hash of the URL, which can be used for comparisons.
358
-    * Since any parameters in the URL's query are sorted alphabetically,
359
-    * the same links with a different parameter order will have the 
360
-    * same hash.
361
-    * 
362
-    * @return string
363
-    */
356
+    /**
357
+     * Creates a hash of the URL, which can be used for comparisons.
358
+     * Since any parameters in the URL's query are sorted alphabetically,
359
+     * the same links with a different parameter order will have the 
360
+     * same hash.
361
+     * 
362
+     * @return string
363
+     */
364 364
     public function getHash()
365 365
     {
366 366
         return \AppUtils\ConvertHelper::string2shortHash($this->getNormalized());
367 367
     }
368 368
 
369
-   /**
370
-    * Highlights the URL using HTML tags with specific highlighting
371
-    * class names.
372
-    * 
373
-    * @return string Will return an empty string if the URL is not valid.
374
-    */
369
+    /**
370
+     * Highlights the URL using HTML tags with specific highlighting
371
+     * class names.
372
+     * 
373
+     * @return string Will return an empty string if the URL is not valid.
374
+     */
375 375
     public function getHighlighted() : string
376 376
     {
377 377
         if(!$this->isValid()) {
@@ -405,15 +405,15 @@  discard block
 block discarded – undo
405 405
         return count($params);
406 406
     }
407 407
     
408
-   /**
409
-    * Retrieves all parameters specified in the url,
410
-    * if any, as an associative array. 
411
-    * 
412
-    * NOTE: Ignores parameters that have been added
413
-    * to the excluded parameters list.
414
-    *
415
-    * @return array
416
-    */
408
+    /**
409
+     * Retrieves all parameters specified in the url,
410
+     * if any, as an associative array. 
411
+     * 
412
+     * NOTE: Ignores parameters that have been added
413
+     * to the excluded parameters list.
414
+     *
415
+     * @return array
416
+     */
417 417
     public function getParams() : array
418 418
     {
419 419
         if(!$this->paramExclusion || empty($this->excludedParams)) {
@@ -431,22 +431,22 @@  discard block
 block discarded – undo
431 431
         return $keep;
432 432
     }
433 433
     
434
-   /**
435
-    * Retrieves the names of all parameters present in the URL, if any.
436
-    * @return string[]
437
-    */
434
+    /**
435
+     * Retrieves the names of all parameters present in the URL, if any.
436
+     * @return string[]
437
+     */
438 438
     public function getParamNames() : array
439 439
     {
440 440
         $params = $this->getParams();
441 441
         return array_keys($params);
442 442
     }
443 443
     
444
-   /**
445
-    * Retrieves a specific parameter value from the URL.
446
-    * 
447
-    * @param string $name
448
-    * @return string The parameter value, or an empty string if it does not exist.
449
-    */
444
+    /**
445
+     * Retrieves a specific parameter value from the URL.
446
+     * 
447
+     * @param string $name
448
+     * @return string The parameter value, or an empty string if it does not exist.
449
+     */
450 450
     public function getParam(string $name) : string
451 451
     {
452 452
         if(isset($this->info['params'][$name])) {
@@ -456,16 +456,16 @@  discard block
 block discarded – undo
456 456
         return '';
457 457
     }
458 458
     
459
-   /**
460
-    * Excludes an URL parameter entirely if present:
461
-    * the parser will act as if the parameter was not
462
-    * even present in the source URL, effectively
463
-    * stripping it.
464
-    *
465
-    * @param string $name
466
-    * @param string $reason A human readable explanation why this is excluded - used when highlighting links.
467
-    * @return URLInfo
468
-    */
459
+    /**
460
+     * Excludes an URL parameter entirely if present:
461
+     * the parser will act as if the parameter was not
462
+     * even present in the source URL, effectively
463
+     * stripping it.
464
+     *
465
+     * @param string $name
466
+     * @param string $reason A human readable explanation why this is excluded - used when highlighting links.
467
+     * @return URLInfo
468
+     */
469 469
     public function excludeParam(string $name, string $reason) : URLInfo
470 470
     {
471 471
         if(!isset($this->excludedParams[$name]))
@@ -518,25 +518,25 @@  discard block
 block discarded – undo
518 518
         return self::$typeLabels[$this->getType()];
519 519
     }
520 520
 
521
-   /**
522
-    * Whether excluded parameters should be highlighted in
523
-    * a different color in the URL when using the
524
-    * {@link URLInfo::getHighlighted()} method.
525
-    *
526
-    * @param bool $highlight
527
-    * @return URLInfo
528
-    */
521
+    /**
522
+     * Whether excluded parameters should be highlighted in
523
+     * a different color in the URL when using the
524
+     * {@link URLInfo::getHighlighted()} method.
525
+     *
526
+     * @param bool $highlight
527
+     * @return URLInfo
528
+     */
529 529
     public function setHighlightExcluded(bool $highlight=true) : URLInfo
530 530
     {
531 531
         $this->highlightExcluded = $highlight;
532 532
         return $this;
533 533
     }
534 534
     
535
-   /**
536
-    * Returns an array with all relevant URL information.
537
-    * 
538
-    * @return array
539
-    */
535
+    /**
536
+     * Returns an array with all relevant URL information.
537
+     * 
538
+     * @return array
539
+     */
540 540
     public function toArray() : array
541 541
     {
542 542
         return array(
@@ -580,24 +580,24 @@  discard block
 block discarded – undo
580 580
         return $this;
581 581
     }
582 582
     
583
-   /**
584
-    * Whether the parameter exclusion mode is enabled:
585
-    * In this case, if any parameters have been added to the
586
-    * exclusion list, all relevant methods will exclude these.
587
-    *
588
-    * @return bool
589
-    */
583
+    /**
584
+     * Whether the parameter exclusion mode is enabled:
585
+     * In this case, if any parameters have been added to the
586
+     * exclusion list, all relevant methods will exclude these.
587
+     *
588
+     * @return bool
589
+     */
590 590
     public function isParamExclusionEnabled() : bool
591 591
     {
592 592
         return $this->paramExclusion;
593 593
     }
594 594
     
595
-   /**
596
-    * Checks whether the link contains any parameters that
597
-    * are on the list of excluded parameters.
598
-    *
599
-    * @return bool
600
-    */
595
+    /**
596
+     * Checks whether the link contains any parameters that
597
+     * are on the list of excluded parameters.
598
+     *
599
+     * @return bool
600
+     */
601 601
     public function containsExcludedParams() : bool
602 602
     {
603 603
         if(empty($this->excludedParams)) {
@@ -665,16 +665,16 @@  discard block
 block discarded – undo
665 665
         return $this->highlightExcluded;
666 666
     }
667 667
     
668
-   /**
669
-    * Checks if the URL exists, i.e. can be connected to. Will return
670
-    * true if the returned HTTP status code is `200` or `302`.
671
-    * 
672
-    * NOTE: If the target URL requires HTTP authentication, the username
673
-    * and password should be integrated into the URL.
674
-    * 
675
-    * @return bool
676
-    * @throws BaseException
677
-    */
668
+    /**
669
+     * Checks if the URL exists, i.e. can be connected to. Will return
670
+     * true if the returned HTTP status code is `200` or `302`.
671
+     * 
672
+     * NOTE: If the target URL requires HTTP authentication, the username
673
+     * and password should be integrated into the URL.
674
+     * 
675
+     * @return bool
676
+     * @throws BaseException
677
+     */
678 678
     public function tryConnect(bool $verifySSL=true) : bool
679 679
     {
680 680
         return $this->createConnectionTester()
@@ -682,26 +682,26 @@  discard block
 block discarded – undo
682 682
         ->canConnect();
683 683
     }
684 684
     
685
-   /**
686
-    * Creates the connection tester instance that is used
687
-    * to check if a URL can be connected to, and which is
688
-    * used in the {@see URLInfo::tryConnect()} method. It
689
-    * allows more settings to be used.
690
-    * 
691
-    * @return URLInfo_ConnectionTester
692
-    */
685
+    /**
686
+     * Creates the connection tester instance that is used
687
+     * to check if a URL can be connected to, and which is
688
+     * used in the {@see URLInfo::tryConnect()} method. It
689
+     * allows more settings to be used.
690
+     * 
691
+     * @return URLInfo_ConnectionTester
692
+     */
693 693
     public function createConnectionTester() : URLInfo_ConnectionTester
694 694
     {
695 695
         return new URLInfo_ConnectionTester($this);
696 696
     }
697 697
     
698
-   /**
699
-    * Adds/overwrites an URL parameter.
700
-    *  
701
-    * @param string $name
702
-    * @param string $val
703
-    * @return URLInfo
704
-    */
698
+    /**
699
+     * Adds/overwrites an URL parameter.
700
+     *  
701
+     * @param string $name
702
+     * @param string $val
703
+     * @return URLInfo
704
+     */
705 705
     public function setParam(string $name, string $val) : URLInfo
706 706
     {
707 707
         $this->info['params'][$name] = $val;
@@ -709,13 +709,13 @@  discard block
 block discarded – undo
709 709
         return $this;
710 710
     }
711 711
     
712
-   /**
713
-    * Removes an URL parameter. Has no effect if the 
714
-    * parameter is not present to begin with.
715
-    * 
716
-    * @param string $param
717
-    * @return URLInfo
718
-    */
712
+    /**
713
+     * Removes an URL parameter. Has no effect if the 
714
+     * parameter is not present to begin with.
715
+     * 
716
+     * @param string $param
717
+     * @return URLInfo
718
+     */
719 719
     public function removeParam(string $param) : URLInfo
720 720
     {
721 721
         if(isset($this->info['params'][$param]))
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
     * @param bool $enabled
124 124
     * @return URLInfo
125 125
     */
126
-    public function setUTFEncoding(bool $enabled=true) : URLInfo
126
+    public function setUTFEncoding(bool $enabled = true) : URLInfo
127 127
     {
128
-        if($this->encodeUTFChars !== $enabled)
128
+        if ($this->encodeUTFChars !== $enabled)
129 129
         {
130 130
             $this->encodeUTFChars = $enabled;
131 131
             $this->parse(); // re-parse the URL to apply the changes
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     {
230 230
         $port = $this->getInfoKey('port');
231 231
         
232
-        if(!empty($port)) {
232
+        if (!empty($port)) {
233 233
             return (int)$port;
234 234
         }
235 235
         
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     
310 310
     protected function getInfoKey(string $name) : string
311 311
     {
312
-        if(isset($this->info[$name])) {
312
+        if (isset($this->info[$name])) {
313 313
             return (string)$this->info[$name];
314 314
         }
315 315
         
@@ -338,13 +338,13 @@  discard block
 block discarded – undo
338 338
         return $this->normalize(false);
339 339
     }
340 340
     
341
-    protected function normalize(bool $auth=true) : string
341
+    protected function normalize(bool $auth = true) : string
342 342
     {
343
-        if(!$this->isValid()) {
343
+        if (!$this->isValid()) {
344 344
             return '';
345 345
         }
346 346
         
347
-        if(!isset($this->normalizer)) {
347
+        if (!isset($this->normalizer)) {
348 348
             $this->normalizer = new URLInfo_Normalizer($this);
349 349
         }
350 350
         
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
     */
375 375
     public function getHighlighted() : string
376 376
     {
377
-        if(!$this->isValid()) {
377
+        if (!$this->isValid()) {
378 378
             return '';
379 379
         }
380 380
         
@@ -416,14 +416,14 @@  discard block
 block discarded – undo
416 416
     */
417 417
     public function getParams() : array
418 418
     {
419
-        if(!$this->paramExclusion || empty($this->excludedParams)) {
419
+        if (!$this->paramExclusion || empty($this->excludedParams)) {
420 420
             return $this->info['params'];
421 421
         }
422 422
         
423 423
         $keep = array();
424
-        foreach($this->info['params'] as $name => $value) 
424
+        foreach ($this->info['params'] as $name => $value) 
425 425
         {
426
-            if(!isset($this->excludedParams[$name])) {
426
+            if (!isset($this->excludedParams[$name])) {
427 427
                 $keep[$name] = $value;
428 428
             }
429 429
         }
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
     */
450 450
     public function getParam(string $name) : string
451 451
     {
452
-        if(isset($this->info['params'][$name])) {
452
+        if (isset($this->info['params'][$name])) {
453 453
             return $this->info['params'][$name];
454 454
         }
455 455
         
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
     */
469 469
     public function excludeParam(string $name, string $reason) : URLInfo
470 470
     {
471
-        if(!isset($this->excludedParams[$name]))
471
+        if (!isset($this->excludedParams[$name]))
472 472
         {
473 473
             $this->excludedParams[$name] = $reason;
474 474
             $this->setParamExclusion();
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
     
495 495
     public function getTypeLabel() : string
496 496
     {
497
-        if(!isset(self::$typeLabels))
497
+        if (!isset(self::$typeLabels))
498 498
         {
499 499
             self::$typeLabels = array(
500 500
                 self::TYPE_EMAIL => t('Email'),
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
         
507 507
         $type = $this->getType();
508 508
         
509
-        if(!isset(self::$typeLabels[$type]))
509
+        if (!isset(self::$typeLabels[$type]))
510 510
         {
511 511
             throw new BaseException(
512 512
                 sprintf('Unknown URL type label for type [%s].', $type),
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
     * @param bool $highlight
527 527
     * @return URLInfo
528 528
     */
529
-    public function setHighlightExcluded(bool $highlight=true) : URLInfo
529
+    public function setHighlightExcluded(bool $highlight = true) : URLInfo
530 530
     {
531 531
         $this->highlightExcluded = $highlight;
532 532
         return $this;
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
      * @see URLInfo::isParamExclusionEnabled()
575 575
      * @see URLInfo::setHighlightExcluded()
576 576
      */
577
-    public function setParamExclusion(bool $enabled=true) : URLInfo
577
+    public function setParamExclusion(bool $enabled = true) : URLInfo
578 578
     {
579 579
         $this->paramExclusion = $enabled;
580 580
         return $this;
@@ -600,13 +600,13 @@  discard block
 block discarded – undo
600 600
     */
601 601
     public function containsExcludedParams() : bool
602 602
     {
603
-        if(empty($this->excludedParams)) {
603
+        if (empty($this->excludedParams)) {
604 604
             return false;
605 605
         }
606 606
         
607 607
         $names = array_keys($this->info['params']);
608
-        foreach($names as $name) {
609
-            if(isset($this->excludedParams[$name])) {
608
+        foreach ($names as $name) {
609
+            if (isset($this->excludedParams[$name])) {
610 610
                 return true;
611 611
             }
612 612
         }
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 
623 623
     public function offsetSet($offset, $value) 
624 624
     {
625
-        if(in_array($offset, $this->infoKeys)) {
625
+        if (in_array($offset, $this->infoKeys)) {
626 626
             $this->info[$offset] = $value;
627 627
         }
628 628
     }
@@ -639,11 +639,11 @@  discard block
 block discarded – undo
639 639
     
640 640
     public function offsetGet($offset) 
641 641
     {
642
-        if($offset === 'port') {
642
+        if ($offset === 'port') {
643 643
             return $this->getPort();
644 644
         }
645 645
         
646
-        if(in_array($offset, $this->infoKeys)) {
646
+        if (in_array($offset, $this->infoKeys)) {
647 647
             return $this->getInfoKey($offset);
648 648
         }
649 649
         
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
     * @return bool
676 676
     * @throws BaseException
677 677
     */
678
-    public function tryConnect(bool $verifySSL=true) : bool
678
+    public function tryConnect(bool $verifySSL = true) : bool
679 679
     {
680 680
         return $this->createConnectionTester()
681 681
         ->setVerifySSL($verifySSL)
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
     */
719 719
     public function removeParam(string $param) : URLInfo
720 720
     {
721
-        if(isset($this->info['params'][$param]))
721
+        if (isset($this->info['params'][$param]))
722 722
         {
723 723
             unset($this->info['params'][$param]);
724 724
         }
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
     const ERROR_CURL_INIT_FAILED = 17903;
33 33
     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;
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
         return $this->eol;
113 113
     }
114 114
     
115
-   /**
116
-    * Sets the timeout for the request, in seconds. If the request
117
-    * takes longer, it will be cancelled and an exception triggered.
118
-    * 
119
-    * @param int $seconds
120
-    * @return RequestHelper
121
-    */
115
+    /**
116
+     * Sets the timeout for the request, in seconds. If the request
117
+     * takes longer, it will be cancelled and an exception triggered.
118
+     * 
119
+     * @param int $seconds
120
+     * @return RequestHelper
121
+     */
122 122
     public function setTimeout(int $seconds) : RequestHelper
123 123
     {
124 124
         $this->timeout = $seconds;
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
         return $this->timeout;
132 132
     }
133 133
     
134
-   /**
135
-    * Enables verbose logging of the CURL request, which
136
-    * is then redirected to the target file.
137
-    * 
138
-    * @param string $targetFile
139
-    * @return RequestHelper
140
-    */
134
+    /**
135
+     * Enables verbose logging of the CURL request, which
136
+     * is then redirected to the target file.
137
+     * 
138
+     * @param string $targetFile
139
+     * @return RequestHelper
140
+     */
141 141
     public function enableLogging(string $targetFile) : RequestHelper
142 142
     {
143 143
         $this->logfile = $targetFile;
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
         return $this;
146 146
     }
147 147
 
148
-   /**
149
-    * Adds a file to be sent with the request.
150
-    *
151
-    * @param string $varName The variable name to send the file in
152
-    * @param string $fileName The name of the file as it should be received at the destination
153
-    * @param string $content The raw content of the file
154
-    * @param string $contentType The content type, use the constants to specify this
155
-    * @param string $encoding The encoding of the file, use the constants to specify this
156
-    */
148
+    /**
149
+     * Adds a file to be sent with the request.
150
+     *
151
+     * @param string $varName The variable name to send the file in
152
+     * @param string $fileName The name of the file as it should be received at the destination
153
+     * @param string $content The raw content of the file
154
+     * @param string $contentType The content type, use the constants to specify this
155
+     * @param string $encoding The encoding of the file, use the constants to specify this
156
+     */
157 157
     public function addFile(string $varName, string $fileName, string $content, string $contentType = '', string $encoding = '') : RequestHelper
158 158
     {
159 159
         $this->boundaries->addFile($varName, $fileName, $content, $contentType, $encoding);
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
         return $this;
162 162
     }
163 163
     
164
-   /**
165
-    * Adds arbitrary content.
166
-    * 
167
-    * @param string $varName The variable name to send the content in.
168
-    * @param string $content
169
-    * @param string $contentType
170
-    */
164
+    /**
165
+     * Adds arbitrary content.
166
+     * 
167
+     * @param string $varName The variable name to send the content in.
168
+     * @param string $content
169
+     * @param string $contentType
170
+     */
171 171
     public function addContent(string $varName, string $content, string $contentType) : RequestHelper
172 172
     {
173 173
         $this->boundaries->addContent($varName, $content, $contentType);
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
         return $this;
176 176
     }
177 177
 
178
-   /**
179
-    * Adds a variable to be sent with the request. If it
180
-    * already exists, its value is overwritten.
181
-    *
182
-    * @param string $name
183
-    * @param string $value
184
-    */
178
+    /**
179
+     * Adds a variable to be sent with the request. If it
180
+     * already exists, its value is overwritten.
181
+     *
182
+     * @param string $name
183
+     * @param string $value
184
+     */
185 185
     public function addVariable(string $name, string $value) : RequestHelper
186 186
     {
187 187
         $this->boundaries->addVariable($name, $value);
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
         return $this;
190 190
     }
191 191
     
192
-   /**
193
-    * Sets an HTTP header to include in the request.
194
-    * 
195
-    * @param string $name
196
-    * @param string $value
197
-    * @return RequestHelper
198
-    */
192
+    /**
193
+     * Sets an HTTP header to include in the request.
194
+     * 
195
+     * @param string $name
196
+     * @param string $value
197
+     * @return RequestHelper
198
+     */
199 199
     public function setHeader(string $name, string $value) : RequestHelper
200 200
     {
201 201
         $this->headers[$name] = $value;
@@ -203,36 +203,36 @@  discard block
 block discarded – undo
203 203
         return $this;
204 204
     }
205 205
     
206
-   /**
207
-    * Disables SSL certificate checking.
208
-    * 
209
-    * @return RequestHelper
210
-    */
206
+    /**
207
+     * Disables SSL certificate checking.
208
+     * 
209
+     * @return RequestHelper
210
+     */
211 211
     public function disableSSLChecks() : RequestHelper
212 212
     {
213 213
         $this->verifySSL = false;
214 214
         return $this;
215 215
     }
216 216
    
217
-   /**
218
-    * @var integer
219
-    */
217
+    /**
218
+     * @var integer
219
+     */
220 220
     protected $contentLength = 0;
221 221
 
222
-   /**
223
-    * Sends the POST request to the destination, and returns
224
-    * the response text.
225
-    *
226
-    * The response object is stored internally, so after calling
227
-    * this method it may be retrieved at any moment using the
228
-    * {@link getResponse()} method.
229
-    *
230
-    * @return string
231
-    * @see RequestHelper::getResponse()
232
-    * @throws RequestHelper_Exception
233
-    * 
234
-    * @see RequestHelper::ERROR_REQUEST_FAILED
235
-    */
222
+    /**
223
+     * Sends the POST request to the destination, and returns
224
+     * the response text.
225
+     *
226
+     * The response object is stored internally, so after calling
227
+     * this method it may be retrieved at any moment using the
228
+     * {@link getResponse()} method.
229
+     *
230
+     * @return string
231
+     * @see RequestHelper::getResponse()
232
+     * @throws RequestHelper_Exception
233
+     * 
234
+     * @see RequestHelper::ERROR_REQUEST_FAILED
235
+     */
236 236
     public function send() : string
237 237
     {
238 238
         $info = parseURL($this->destination);
@@ -272,26 +272,26 @@  discard block
 block discarded – undo
272 272
         return $this->response->getResponseBody();
273 273
     }
274 274
     
275
-   /**
276
-    * Retrieves the request's body content. This is an alias
277
-    * for {@see RequestHelper::getMimeBody()}.
278
-    * 
279
-    * @return string
280
-    * @see RequestHelper::getMimeBody()
281
-    */
275
+    /**
276
+     * Retrieves the request's body content. This is an alias
277
+     * for {@see RequestHelper::getMimeBody()}.
278
+     * 
279
+     * @return string
280
+     * @see RequestHelper::getMimeBody()
281
+     */
282 282
     public function getBody() : string
283 283
     {
284 284
         return $this->getMimeBody();
285 285
     }
286 286
     
287
-   /**
288
-    * Creates a new CURL resource configured according to the
289
-    * request's settings.
290
-    * 
291
-    * @param URLInfo $url
292
-    * @throws RequestHelper_Exception
293
-    * @return resource
294
-    */
287
+    /**
288
+     * Creates a new CURL resource configured according to the
289
+     * request's settings.
290
+     * 
291
+     * @param URLInfo $url
292
+     * @throws RequestHelper_Exception
293
+     * @return resource
294
+     */
295 295
     protected function createCURL(URLInfo $url)
296 296
     {
297 297
         $ch = curl_init();
@@ -339,10 +339,10 @@  discard block
 block discarded – undo
339 339
         return $ch;
340 340
     }
341 341
     
342
-   /**
343
-    * @param resource $ch
344
-    * @return bool Whether logging is enabled.
345
-    */
342
+    /**
343
+     * @param resource $ch
344
+     * @return bool Whether logging is enabled.
345
+     */
346 346
     protected function configureLogging($ch) : bool
347 347
     {
348 348
         if(empty($this->logfile))
@@ -369,13 +369,13 @@  discard block
 block discarded – undo
369 369
         return true;
370 370
     }
371 371
 
372
-   /**
373
-    * Compiles the associative headers array into
374
-    * the format understood by CURL, namely an indexed
375
-    * array with one header string per entry.
376
-    * 
377
-    * @return array
378
-    */
372
+    /**
373
+     * Compiles the associative headers array into
374
+     * the format understood by CURL, namely an indexed
375
+     * array with one header string per entry.
376
+     * 
377
+     * @return array
378
+     */
379 379
     protected function renderHeaders() : array
380 380
     {
381 381
         $result = array();
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
         return $result;
390 390
     }
391 391
     
392
-   /**
393
-    * Retrieves the raw response header, in the form of an indexed
394
-    * array containing all response header lines.
395
-    * 
396
-    * @return array
397
-    */
392
+    /**
393
+     * Retrieves the raw response header, in the form of an indexed
394
+     * array containing all response header lines.
395
+     * 
396
+     * @return array
397
+     */
398 398
     public function getResponseHeader() : array
399 399
     {
400 400
         $response = $this->getResponse();
@@ -406,33 +406,33 @@  discard block
 block discarded – undo
406 406
         return array();
407 407
     }
408 408
 
409
-   /**
410
-    * After calling the {@link send()} method, this may be used to
411
-    * retrieve the response text from the POST request.
412
-    *
413
-    * @return RequestHelper_Response|NULL
414
-    */
409
+    /**
410
+     * After calling the {@link send()} method, this may be used to
411
+     * retrieve the response text from the POST request.
412
+     *
413
+     * @return RequestHelper_Response|NULL
414
+     */
415 415
     public function getResponse() : ?RequestHelper_Response
416 416
     {
417 417
         return $this->response;
418 418
     }
419 419
     
420
-   /**
421
-    * Retrieves all headers set until now.
422
-    * 
423
-    * @return array<string,string>
424
-    */
420
+    /**
421
+     * Retrieves all headers set until now.
422
+     * 
423
+     * @return array<string,string>
424
+     */
425 425
     public function getHeaders() : array
426 426
     {
427 427
         return $this->headers;
428 428
     }
429 429
     
430
-   /**
431
-    * Retrieves the value of a header by its name.
432
-    * 
433
-    * @param string $name
434
-    * @return string The header value, or an empty string if not set.
435
-    */
430
+    /**
431
+     * Retrieves the value of a header by its name.
432
+     * 
433
+     * @param string $name
434
+     * @return string The header value, or an empty string if not set.
435
+     */
436 436
     public function getHeader(string $name) : string
437 437
     {
438 438
         if(isset($this->headers[$name]))
Please login to merge, or discard this patch.