Passed
Push — master ( 32692a...12a81e )
by Sebastian
02:54
created
src/URLInfo.php 1 patch
Indentation   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -39,42 +39,42 @@  discard block
 block discarded – undo
39 39
     const TYPE_PHONE = 'phone';
40 40
     const TYPE_URL = 'url';
41 41
     
42
-   /**
43
-    * The original URL that was passed to the constructor.
44
-    * @var string
45
-    */
42
+    /**
43
+     * The original URL that was passed to the constructor.
44
+     * @var string
45
+     */
46 46
     protected $rawURL;
47 47
 
48
-   /**
49
-    * @var array
50
-    */
48
+    /**
49
+     * @var array
50
+     */
51 51
     protected $info;
52 52
     
53
-   /**
54
-    * @var string[]
55
-    */
53
+    /**
54
+     * @var string[]
55
+     */
56 56
     protected $excludedParams = array();
57 57
     
58
-   /**
59
-    * @var bool
60
-    * @see URLInfo::setParamExclusion()
61
-    */
58
+    /**
59
+     * @var bool
60
+     * @see URLInfo::setParamExclusion()
61
+     */
62 62
     protected $paramExclusion = false;
63 63
     
64
-   /**
65
-    * @var array
66
-    * @see URLInfo::getTypeLabel()
67
-    */
64
+    /**
65
+     * @var array
66
+     * @see URLInfo::getTypeLabel()
67
+     */
68 68
     protected static $typeLabels;
69 69
     
70
-   /**
71
-    * @var bool
72
-    */
70
+    /**
71
+     * @var bool
72
+     */
73 73
     protected $highlightExcluded = false;
74 74
     
75
-   /**
76
-    * @var array
77
-    */
75
+    /**
76
+     * @var array
77
+     */
78 78
     protected $infoKeys = array(
79 79
         'scheme',
80 80
         'host',
@@ -86,19 +86,19 @@  discard block
 block discarded – undo
86 86
         'fragment'
87 87
     );
88 88
     
89
-   /**
90
-    * @var string
91
-    */
89
+    /**
90
+     * @var string
91
+     */
92 92
     protected $url;
93 93
     
94
-   /**
95
-    * @var URLInfo_Parser
96
-    */
94
+    /**
95
+     * @var URLInfo_Parser
96
+     */
97 97
     protected $parser;
98 98
     
99
-   /**
100
-    * @var URLInfo_Normalizer
101
-    */
99
+    /**
100
+     * @var URLInfo_Normalizer
101
+     */
102 102
     protected $normalizer;
103 103
     
104 104
     public function __construct(string $url)
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
         $this->info = $this->parser->getInfo();
111 111
     }
112 112
     
113
-   /**
114
-    * Filters an URL: removes control characters and the
115
-    * like to have a clean URL to work with.
116
-    * 
117
-    * @param string $url
118
-    * @return string
119
-    */
113
+    /**
114
+     * Filters an URL: removes control characters and the
115
+     * like to have a clean URL to work with.
116
+     * 
117
+     * @param string $url
118
+     * @return string
119
+     */
120 120
     public static function filterURL(string $url)
121 121
     {
122 122
         return URLInfo_Filter::filter($url);
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
         return $this->info['type'] === self::TYPE_PHONE;
147 147
     }
148 148
     
149
-   /**
150
-    * Whether the URL is a regular URL, not one of the 
151
-    * other types like a phone number or email address.
152
-    * 
153
-    * @return bool
154
-    */
149
+    /**
150
+     * Whether the URL is a regular URL, not one of the 
151
+     * other types like a phone number or email address.
152
+     * 
153
+     * @return bool
154
+     */
155 155
     public function isURL() : bool
156 156
     {
157 157
         $host = $this->getHost();
@@ -163,20 +163,20 @@  discard block
 block discarded – undo
163 163
         return $this->parser->isValid();
164 164
     }
165 165
     
166
-   /**
167
-    * Retrieves the host name, or an empty string if none is present.
168
-    * 
169
-    * @return string
170
-    */
166
+    /**
167
+     * Retrieves the host name, or an empty string if none is present.
168
+     * 
169
+     * @return string
170
+     */
171 171
     public function getHost() : string
172 172
     {
173 173
         return $this->getInfoKey('host');
174 174
     }
175 175
     
176
-   /**
177
-    * Retrieves the path, or an empty string if none is present.
178
-    * @return string
179
-    */
176
+    /**
177
+     * Retrieves the path, or an empty string if none is present.
178
+     * @return string
179
+     */
180 180
     public function getPath() : string
181 181
     {
182 182
         return $this->getInfoKey('path');
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
         return $this->getInfoKey('scheme');
193 193
     }
194 194
     
195
-   /**
196
-    * Retrieves the port specified in the URL, or -1 if none is preseent.
197
-    * @return int
198
-    */
195
+    /**
196
+     * Retrieves the port specified in the URL, or -1 if none is preseent.
197
+     * @return int
198
+     */
199 199
     public function getPort() : int
200 200
     {
201 201
         $port = $this->getInfoKey('port');
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
         return -1;
208 208
     }
209 209
     
210
-   /**
211
-    * Retrieves the raw query string, or an empty string if none is present.
212
-    * 
213
-    * @return string
214
-    * 
215
-    * @see URLInfo::getParams()
216
-    */
210
+    /**
211
+     * Retrieves the raw query string, or an empty string if none is present.
212
+     * 
213
+     * @return string
214
+     * 
215
+     * @see URLInfo::getParams()
216
+     */
217 217
     public function getQuery() : string
218 218
     {
219 219
         return $this->getInfoKey('query');
@@ -229,20 +229,20 @@  discard block
 block discarded – undo
229 229
         return $this->getInfoKey('pass');
230 230
     }
231 231
     
232
-   /**
233
-    * Whether the URL contains a port number.
234
-    * @return bool
235
-    */
232
+    /**
233
+     * Whether the URL contains a port number.
234
+     * @return bool
235
+     */
236 236
     public function hasPort() : bool
237 237
     {
238 238
         return $this->getPort() !== -1;
239 239
     }
240 240
     
241
-   /**
242
-    * Alias for the hasParams() method.
243
-    * @return bool
244
-    * @see URLInfo::hasParams()
245
-    */
241
+    /**
242
+     * Alias for the hasParams() method.
243
+     * @return bool
244
+     * @see URLInfo::hasParams()
245
+     */
246 246
     public function hasQuery() : bool
247 247
     {
248 248
         return $this->hasParams();
@@ -314,25 +314,25 @@  discard block
 block discarded – undo
314 314
         return $this->normalizer->normalize();
315 315
     }
316 316
     
317
-   /**
318
-    * Creates a hash of the URL, which can be used for comparisons.
319
-    * Since any parameters in the URL's query are sorted alphabetically,
320
-    * the same links with a different parameter order will have the 
321
-    * same hash.
322
-    * 
323
-    * @return string
324
-    */
317
+    /**
318
+     * Creates a hash of the URL, which can be used for comparisons.
319
+     * Since any parameters in the URL's query are sorted alphabetically,
320
+     * the same links with a different parameter order will have the 
321
+     * same hash.
322
+     * 
323
+     * @return string
324
+     */
325 325
     public function getHash()
326 326
     {
327 327
         return \AppUtils\ConvertHelper::string2shortHash($this->getNormalized());
328 328
     }
329 329
 
330
-   /**
331
-    * Highlights the URL using HTML tags with specific highlighting
332
-    * class names.
333
-    * 
334
-    * @return string Will return an empty string if the URL is not valid.
335
-    */
330
+    /**
331
+     * Highlights the URL using HTML tags with specific highlighting
332
+     * class names.
333
+     * 
334
+     * @return string Will return an empty string if the URL is not valid.
335
+     */
336 336
     public function getHighlighted() : string
337 337
     {
338 338
         if(!$this->isValid()) {
@@ -366,15 +366,15 @@  discard block
 block discarded – undo
366 366
         return count($params);
367 367
     }
368 368
     
369
-   /**
370
-    * Retrieves all parameters specified in the url,
371
-    * if any, as an associative array. 
372
-    * 
373
-    * NOTE: Ignores parameters that have been added
374
-    * to the excluded parameters list.
375
-    *
376
-    * @return array
377
-    */
369
+    /**
370
+     * Retrieves all parameters specified in the url,
371
+     * if any, as an associative array. 
372
+     * 
373
+     * NOTE: Ignores parameters that have been added
374
+     * to the excluded parameters list.
375
+     *
376
+     * @return array
377
+     */
378 378
     public function getParams() : array
379 379
     {
380 380
         if(!$this->paramExclusion || empty($this->excludedParams)) {
@@ -392,22 +392,22 @@  discard block
 block discarded – undo
392 392
         return $keep;
393 393
     }
394 394
     
395
-   /**
396
-    * Retrieves the names of all parameters present in the URL, if any.
397
-    * @return string[]
398
-    */
395
+    /**
396
+     * Retrieves the names of all parameters present in the URL, if any.
397
+     * @return string[]
398
+     */
399 399
     public function getParamNames() : array
400 400
     {
401 401
         $params = $this->getParams();
402 402
         return array_keys($params);
403 403
     }
404 404
     
405
-   /**
406
-    * Retrieves a specific parameter value from the URL.
407
-    * 
408
-    * @param string $name
409
-    * @return string The parameter value, or an empty string if it does not exist.
410
-    */
405
+    /**
406
+     * Retrieves a specific parameter value from the URL.
407
+     * 
408
+     * @param string $name
409
+     * @return string The parameter value, or an empty string if it does not exist.
410
+     */
411 411
     public function getParam(string $name) : string
412 412
     {
413 413
         if(isset($this->info['params'][$name])) {
@@ -417,16 +417,16 @@  discard block
 block discarded – undo
417 417
         return '';
418 418
     }
419 419
     
420
-   /**
421
-    * Excludes an URL parameter entirely if present:
422
-    * the parser will act as if the parameter was not
423
-    * even present in the source URL, effectively
424
-    * stripping it.
425
-    *
426
-    * @param string $name
427
-    * @param string $reason A human readable explanation why this is excluded - used when highlighting links.
428
-    * @return URLInfo
429
-    */
420
+    /**
421
+     * Excludes an URL parameter entirely if present:
422
+     * the parser will act as if the parameter was not
423
+     * even present in the source URL, effectively
424
+     * stripping it.
425
+     *
426
+     * @param string $name
427
+     * @param string $reason A human readable explanation why this is excluded - used when highlighting links.
428
+     * @return URLInfo
429
+     */
430 430
     public function excludeParam(string $name, string $reason) : URLInfo
431 431
     {
432 432
         if(!isset($this->excludedParams[$name]))
@@ -479,25 +479,25 @@  discard block
 block discarded – undo
479 479
         return self::$typeLabels[$this->getType()];
480 480
     }
481 481
 
482
-   /**
483
-    * Whether excluded parameters should be highlighted in
484
-    * a different color in the URL when using the
485
-    * {@link URLInfo::getHighlighted()} method.
486
-    *
487
-    * @param bool $highlight
488
-    * @return URLInfo
489
-    */
482
+    /**
483
+     * Whether excluded parameters should be highlighted in
484
+     * a different color in the URL when using the
485
+     * {@link URLInfo::getHighlighted()} method.
486
+     *
487
+     * @param bool $highlight
488
+     * @return URLInfo
489
+     */
490 490
     public function setHighlightExcluded(bool $highlight=true) : URLInfo
491 491
     {
492 492
         $this->highlightExcluded = $highlight;
493 493
         return $this;
494 494
     }
495 495
     
496
-   /**
497
-    * Returns an array with all relevant URL information.
498
-    * 
499
-    * @return array
500
-    */
496
+    /**
497
+     * Returns an array with all relevant URL information.
498
+     * 
499
+     * @return array
500
+     */
501 501
     public function toArray() : array
502 502
     {
503 503
         return array(
@@ -541,24 +541,24 @@  discard block
 block discarded – undo
541 541
         return $this;
542 542
     }
543 543
     
544
-   /**
545
-    * Whether the parameter exclusion mode is enabled:
546
-    * In this case, if any parameters have been added to the
547
-    * exclusion list, all relevant methods will exclude these.
548
-    *
549
-    * @return bool
550
-    */
544
+    /**
545
+     * Whether the parameter exclusion mode is enabled:
546
+     * In this case, if any parameters have been added to the
547
+     * exclusion list, all relevant methods will exclude these.
548
+     *
549
+     * @return bool
550
+     */
551 551
     public function isParamExclusionEnabled() : bool
552 552
     {
553 553
         return $this->paramExclusion;
554 554
     }
555 555
     
556
-   /**
557
-    * Checks whether the link contains any parameters that
558
-    * are on the list of excluded parameters.
559
-    *
560
-    * @return bool
561
-    */
556
+    /**
557
+     * Checks whether the link contains any parameters that
558
+     * are on the list of excluded parameters.
559
+     *
560
+     * @return bool
561
+     */
562 562
     public function containsExcludedParams() : bool
563 563
     {
564 564
         if(empty($this->excludedParams)) {
@@ -626,16 +626,16 @@  discard block
 block discarded – undo
626 626
         return $this->highlightExcluded;
627 627
     }
628 628
     
629
-   /**
630
-    * Checks if the URL exists, i.e. can be connected to. Will return
631
-    * true if the returned HTTP status code is `200` or `302`.
632
-    * 
633
-    * NOTE: If the target URL requires HTTP authentication, the username
634
-    * and password should be integrated into the URL.
635
-    * 
636
-    * @return bool
637
-    * @throws BaseException
638
-    */
629
+    /**
630
+     * Checks if the URL exists, i.e. can be connected to. Will return
631
+     * true if the returned HTTP status code is `200` or `302`.
632
+     * 
633
+     * NOTE: If the target URL requires HTTP authentication, the username
634
+     * and password should be integrated into the URL.
635
+     * 
636
+     * @return bool
637
+     * @throws BaseException
638
+     */
639 639
     public function tryConnect(bool $verifySSL=true) : bool
640 640
     {
641 641
         requireCURL();
Please login to merge, or discard this patch.
src/RequestHelper/Response.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -21,35 +21,35 @@  discard block
 block discarded – undo
21 21
 {
22 22
     protected $request;
23 23
     
24
-   /**
25
-    * @var string
26
-    */
24
+    /**
25
+     * @var string
26
+     */
27 27
     protected $body = '';
28 28
     
29
-   /**
30
-    * @var array
31
-    */
29
+    /**
30
+     * @var array
31
+     */
32 32
     protected $info;
33 33
     
34
-   /**
35
-    * @var bool
36
-    */
34
+    /**
35
+     * @var bool
36
+     */
37 37
     protected $isError = false;
38 38
     
39
-   /**
40
-    * @var string
41
-    */
39
+    /**
40
+     * @var string
41
+     */
42 42
     protected $errorMessage = '';
43 43
     
44
-   /**
45
-    * @var integer
46
-    */
44
+    /**
45
+     * @var integer
46
+     */
47 47
     protected $errorCode = 0;
48 48
     
49
-   /**
50
-    * @param RequestHelper $helper
51
-    * @param array $info The CURL info array from curl_getinfo().
52
-    */
49
+    /**
50
+     * @param RequestHelper $helper
51
+     * @param array $info The CURL info array from curl_getinfo().
52
+     */
53 53
     public function __construct(RequestHelper $helper, array $info)
54 54
     {
55 55
         $this->request = $helper;
@@ -71,70 +71,70 @@  discard block
 block discarded – undo
71 71
         return $this;
72 72
     }
73 73
     
74
-   /**
75
-    * Whether an error occurred in the request.
76
-    * @return bool
77
-    */
74
+    /**
75
+     * Whether an error occurred in the request.
76
+     * @return bool
77
+     */
78 78
     public function isError() : bool
79 79
     {
80 80
         return $this->isError;
81 81
     }
82 82
     
83
-   /**
84
-    * Retrieves the native error message, if an error occurred.
85
-    * @return string
86
-    */
83
+    /**
84
+     * Retrieves the native error message, if an error occurred.
85
+     * @return string
86
+     */
87 87
     public function getErrorMessage() : string
88 88
     {
89 89
         return $this->errorMessage;
90 90
     }
91 91
     
92
-   /**
93
-    * Retrieves the native error code, if an error occurred.
94
-    * @return int
95
-    */
92
+    /**
93
+     * Retrieves the native error code, if an error occurred.
94
+     * @return int
95
+     */
96 96
     public function getErrorCode() : int
97 97
     {
98 98
         return $this->errorCode;
99 99
     }
100 100
     
101 101
     
102
-   /**
103
-    * Retrieves the full body of the request.
104
-    * 
105
-    * @return string
106
-    */
102
+    /**
103
+     * Retrieves the full body of the request.
104
+     * 
105
+     * @return string
106
+     */
107 107
     public function getRequestBody() : string
108 108
     {
109 109
         return $this->request->getBody();
110 110
     }
111 111
     
112
-   /**
113
-    * Retrieves the body of the response, if any.
114
-    * 
115
-    * @return string
116
-    */
112
+    /**
113
+     * Retrieves the body of the response, if any.
114
+     * 
115
+     * @return string
116
+     */
117 117
     public function getResponseBody() : string
118 118
     {
119 119
         return $this->body;
120 120
     }
121 121
     
122
-   /**
123
-    * The response HTTP code.
124
-    * 
125
-    * @return int The code, or 0 if none was sent (on error).
126
-    */
122
+    /**
123
+     * The response HTTP code.
124
+     * 
125
+     * @return int The code, or 0 if none was sent (on error).
126
+     */
127 127
     public function getCode() : int
128 128
     {
129 129
         return intval($this->getInfoKey('http_code'));
130 130
     }
131 131
     
132
-   /**
133
-    * Retrieves the actual headers that were sent in the request:
134
-    * one header by entry in the indexed array.
135
-    * 
136
-    * @return array
137
-    */
132
+    /**
133
+     * Retrieves the actual headers that were sent in the request:
134
+     * one header by entry in the indexed array.
135
+     * 
136
+     * @return array
137
+     */
138 138
     public function getHeaders() : array
139 139
     {
140 140
         return ConvertHelper::explodeTrim("\n", $this->getInfoKey('request_header'));
Please login to merge, or discard this patch.
src/RequestHelper/Exception.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class RequestHelper_Exception extends BaseException
24 24
 {
25
-   /**
26
-    * @var RequestHelper_Response|NULL
27
-    */
25
+    /**
26
+     * @var RequestHelper_Response|NULL
27
+     */
28 28
     protected $response = null;
29 29
  
30 30
     public function setResponse(RequestHelper_Response $response)
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
         $this->response = $response;
33 33
     }
34 34
     
35
-   /**
36
-    * Retrieves the related response instance, if available.
37
-    * 
38
-    * @return RequestHelper_Response|NULL
39
-    */
35
+    /**
36
+     * Retrieves the related response instance, if available.
37
+     * 
38
+     * @return RequestHelper_Response|NULL
39
+     */
40 40
     public function getResponse() : ?RequestHelper_Response
41 41
     {
42 42
         return $this->response;
Please login to merge, or discard this patch.
src/RequestHelper/Boundaries/Boundary.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -19,29 +19,29 @@
 block discarded – undo
19 19
  */
20 20
 class RequestHelper_Boundaries_Boundary
21 21
 {
22
-   /**
23
-    * @var string
24
-    */
22
+    /**
23
+     * @var string
24
+     */
25 25
     protected $content;
26 26
     
27
-   /**
28
-    * @var array
29
-    */
27
+    /**
28
+     * @var array
29
+     */
30 30
     protected $dispositionParams = array();
31 31
 
32
-   /**
33
-    * @var string
34
-    */
32
+    /**
33
+     * @var string
34
+     */
35 35
     protected $contentType = '';
36 36
 
37
-   /**
38
-    * @var string
39
-    */
37
+    /**
38
+     * @var string
39
+     */
40 40
     protected $contentEncoding = '';
41 41
     
42
-   /**
43
-    * @var RequestHelper_Boundaries
44
-    */
42
+    /**
43
+     * @var RequestHelper_Boundaries
44
+     */
45 45
     protected $boundaries;
46 46
     
47 47
     public function __construct(RequestHelper_Boundaries $boundaries, string $content)
Please login to merge, or discard this patch.
src/RequestHelper/Boundaries.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class RequestHelper_Boundaries
22 22
 {
23
-   /**
24
-    * @var RequestHelper
25
-    */
23
+    /**
24
+     * @var RequestHelper
25
+     */
26 26
     protected $helper;
27 27
 
28
-   /**
29
-    * @var RequestHelper_Boundaries_Boundary[]
30
-    */
28
+    /**
29
+     * @var RequestHelper_Boundaries_Boundary[]
30
+     */
31 31
     protected $boundaries = array();
32 32
     
33
-   /**
34
-    * @var integer
35
-    */
33
+    /**
34
+     * @var integer
35
+     */
36 36
     protected $contentLength = 0;
37 37
     
38 38
     public function __construct(RequestHelper $helper)
@@ -50,24 +50,24 @@  discard block
 block discarded – undo
50 50
         return $this->helper->getEOL();
51 51
     }
52 52
     
53
-   /**
54
-    * Retrieves the total content length of all boundaries.
55
-    * @return int
56
-    */
53
+    /**
54
+     * Retrieves the total content length of all boundaries.
55
+     * @return int
56
+     */
57 57
     public function getContentLength() : int
58 58
     {
59 59
         return $this->contentLength;
60 60
     }
61 61
     
62
-   /**
63
-    * Adds a file to be sent with the request.
64
-    *
65
-    * @param string $varName The variable name to send the file in
66
-    * @param string $fileName The name of the file as it should be received at the destination
67
-    * @param string $content The raw content of the file
68
-    * @param string $contentType The content type, use the constants to specify this
69
-    * @param string $encoding The encoding of the file, use the constants to specify this
70
-    */
62
+    /**
63
+     * Adds a file to be sent with the request.
64
+     *
65
+     * @param string $varName The variable name to send the file in
66
+     * @param string $fileName The name of the file as it should be received at the destination
67
+     * @param string $content The raw content of the file
68
+     * @param string $contentType The content type, use the constants to specify this
69
+     * @param string $encoding The encoding of the file, use the constants to specify this
70
+     */
71 71
     public function addFile(string $varName, string $fileName, string $content, string $contentType = RequestHelper::FILETYPE_TEXT, string $encoding = RequestHelper::ENCODING_UTF8) : RequestHelper_Boundaries
72 72
     {
73 73
         $boundary = $this->createBoundary(chunk_split(base64_encode($content)))
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
         $this->addBoundary($boundary);
80 80
     }
81 81
     
82
-   /**
83
-    * Adds arbitrary content.
84
-    *
85
-    * @param string $varName
86
-    * @param string $content
87
-    * @param string $contentType
88
-    */
82
+    /**
83
+     * Adds arbitrary content.
84
+     *
85
+     * @param string $varName
86
+     * @param string $content
87
+     * @param string $contentType
88
+     */
89 89
     public function addContent(string $varName, string $content, string $contentType) : RequestHelper_Boundaries
90 90
     {
91 91
         $boundary = $this->createBoundary($content)
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
         return $this->addBoundary($boundary);
97 97
     }
98 98
     
99
-   /**
100
-    * Adds a variable to be sent with the request. If it
101
-    * already exists, its value is overwritten.
102
-    *
103
-    * @param string $name
104
-    * @param string $value
105
-    */
99
+    /**
100
+     * Adds a variable to be sent with the request. If it
101
+     * already exists, its value is overwritten.
102
+     *
103
+     * @param string $name
104
+     * @param string $value
105
+     */
106 106
     public function addVariable(string $name, string $value) : RequestHelper_Boundaries
107 107
     {
108 108
         $boundary = $this->createBoundary($value)
Please login to merge, or discard this patch.
src/RequestHelper.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -29,56 +29,56 @@  discard block
 block discarded – undo
29 29
     
30 30
     const ERROR_CURL_INIT_FAILED = 17903;
31 31
 
32
-   /**
33
-    * @var string
34
-    */
32
+    /**
33
+     * @var string
34
+     */
35 35
     protected $eol = "\r\n";
36 36
 
37
-   /**
38
-    * @var string
39
-    */
37
+    /**
38
+     * @var string
39
+     */
40 40
     protected $mimeBoundary;
41 41
 
42
-   /**
43
-    * @var string
44
-    */
42
+    /**
43
+     * @var string
44
+     */
45 45
     protected $data = '';
46 46
 
47
-   /**
48
-    * @var string
49
-    */
47
+    /**
48
+     * @var string
49
+     */
50 50
     protected $destination;
51 51
 
52
-   /**
53
-    * @var array
54
-    */
52
+    /**
53
+     * @var array
54
+     */
55 55
     protected $headers = array();
56 56
     
57
-   /**
58
-    * Whether to verify SSL certificates.
59
-    * @var bool
60
-    */
57
+    /**
58
+     * Whether to verify SSL certificates.
59
+     * @var bool
60
+     */
61 61
     protected $verifySSL = true;
62 62
     
63
-   /**
64
-    * @var RequestHelper_Boundaries
65
-    */
63
+    /**
64
+     * @var RequestHelper_Boundaries
65
+     */
66 66
     protected $boundaries;
67 67
     
68
-   /**
69
-    * @var RequestHelper_Response|NULL
70
-    */
68
+    /**
69
+     * @var RequestHelper_Response|NULL
70
+     */
71 71
     protected $response;
72 72
 
73
-   /**
74
-    * @var integer
75
-    */
73
+    /**
74
+     * @var integer
75
+     */
76 76
     protected $timeout = 30;
77 77
     
78
-   /**
79
-    * Creates a new request helper to send POST data to the specified destination URL.
80
-    * @param string $destinationURL
81
-    */
78
+    /**
79
+     * Creates a new request helper to send POST data to the specified destination URL.
80
+     * @param string $destinationURL
81
+     */
82 82
     public function __construct(string $destinationURL)
83 83
     {
84 84
         $this->destination = $destinationURL;
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
         return $this;
106 106
     }
107 107
 
108
-   /**
109
-    * Adds a file to be sent with the request.
110
-    *
111
-    * @param string $varName The variable name to send the file in
112
-    * @param string $fileName The name of the file as it should be received at the destination
113
-    * @param string $content The raw content of the file
114
-    * @param string $contentType The content type, use the constants to specify this
115
-    * @param string $encoding The encoding of the file, use the constants to specify this
116
-    */
108
+    /**
109
+     * Adds a file to be sent with the request.
110
+     *
111
+     * @param string $varName The variable name to send the file in
112
+     * @param string $fileName The name of the file as it should be received at the destination
113
+     * @param string $content The raw content of the file
114
+     * @param string $contentType The content type, use the constants to specify this
115
+     * @param string $encoding The encoding of the file, use the constants to specify this
116
+     */
117 117
     public function addFile(string $varName, string $fileName, string $content, string $contentType = self::FILETYPE_TEXT, string $encoding = self::ENCODING_UTF8) : RequestHelper
118 118
     {
119 119
         $this->boundaries->addFile($varName, $fileName, $content, $contentType, $encoding);
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
         return $this;
122 122
     }
123 123
     
124
-   /**
125
-    * Adds arbitrary content.
126
-    * 
127
-    * @param string $varName The variable name to send the content in.
128
-    * @param string $content
129
-    * @param string $contentType
130
-    */
124
+    /**
125
+     * Adds arbitrary content.
126
+     * 
127
+     * @param string $varName The variable name to send the content in.
128
+     * @param string $content
129
+     * @param string $contentType
130
+     */
131 131
     public function addContent(string $varName, string $content, string $contentType) : RequestHelper
132 132
     {
133 133
         $this->boundaries->addContent($varName, $content, $contentType);
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
         return $this;
150 150
     }
151 151
     
152
-   /**
153
-    * Sets an HTTP header to include in the request.
154
-    * 
155
-    * @param string $name
156
-    * @param string $value
157
-    * @return RequestHelper
158
-    */
152
+    /**
153
+     * Sets an HTTP header to include in the request.
154
+     * 
155
+     * @param string $name
156
+     * @param string $value
157
+     * @return RequestHelper
158
+     */
159 159
     public function setHeader(string $name, string $value) : RequestHelper
160 160
     {
161 161
         $this->headers[$name] = $value;
@@ -163,36 +163,36 @@  discard block
 block discarded – undo
163 163
         return $this;
164 164
     }
165 165
     
166
-   /**
167
-    * Disables SSL certificate checking.
168
-    * 
169
-    * @return RequestHelper
170
-    */
166
+    /**
167
+     * Disables SSL certificate checking.
168
+     * 
169
+     * @return RequestHelper
170
+     */
171 171
     public function disableSSLChecks() : RequestHelper
172 172
     {
173 173
         $this->verifySSL = false;
174 174
         return $this;
175 175
     }
176 176
    
177
-   /**
178
-    * @var integer
179
-    */
177
+    /**
178
+     * @var integer
179
+     */
180 180
     protected $contentLength = 0;
181 181
 
182
-   /**
183
-    * Sends the POST request to the destination, and returns
184
-    * the response text.
185
-    *
186
-    * The response object is stored internally, so after calling
187
-    * this method it may be retrieved at any moment using the
188
-    * {@link getResponse()} method.
189
-    *
190
-    * @return string
191
-    * @see RequestHelper::getResponse()
192
-    * @throws RequestHelper_Exception
193
-    * 
194
-    * @see RequestHelper::ERROR_REQUEST_FAILED
195
-    */
182
+    /**
183
+     * Sends the POST request to the destination, and returns
184
+     * the response text.
185
+     *
186
+     * The response object is stored internally, so after calling
187
+     * this method it may be retrieved at any moment using the
188
+     * {@link getResponse()} method.
189
+     *
190
+     * @return string
191
+     * @see RequestHelper::getResponse()
192
+     * @throws RequestHelper_Exception
193
+     * 
194
+     * @see RequestHelper::ERROR_REQUEST_FAILED
195
+     */
196 196
     public function send() : string
197 197
     {
198 198
         $this->data = $this->boundaries->render();
@@ -232,14 +232,14 @@  discard block
 block discarded – undo
232 232
         return $this->data;
233 233
     }
234 234
     
235
-   /**
236
-    * Creates a new CURL resource configured according to the
237
-    * request's settings.
238
-    * 
239
-    * @param URLInfo $url
240
-    * @throws RequestHelper_Exception
241
-    * @return resource
242
-    */
235
+    /**
236
+     * Creates a new CURL resource configured according to the
237
+     * request's settings.
238
+     * 
239
+     * @param URLInfo $url
240
+     * @throws RequestHelper_Exception
241
+     * @return resource
242
+     */
243 243
     protected function createCURL(URLInfo $url)
244 244
     {
245 245
         $ch = curl_init();
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
         return $result;
291 291
     }
292 292
     
293
-   /**
294
-    * Retrieves the raw response header, in the form of an indexed
295
-    * array containing all response header lines, for example:
296
-    */
293
+    /**
294
+     * Retrieves the raw response header, in the form of an indexed
295
+     * array containing all response header lines, for example:
296
+     */
297 297
     public function getResponseHeader()
298 298
     {
299 299
         return $this->response->getInfo();
Please login to merge, or discard this patch.