Passed
Push — master ( e685ae...2d43fd )
by Sebastian
02:31
created
src/ConvertHelper/DurationConverter.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -26,39 +26,39 @@  discard block
 block discarded – undo
26 26
     const ERROR_NO_DATE_FROM_SET = 43401;
27 27
     
28 28
     
29
-   /**
30
-    * @var int
31
-    */
29
+    /**
30
+     * @var int
31
+     */
32 32
     protected $dateFrom;
33 33
     
34
-   /**
35
-    * @var int
36
-    */
34
+    /**
35
+     * @var int
36
+     */
37 37
     protected $dateTo;
38 38
     
39
-   /**
40
-    * @var bool
41
-    */
39
+    /**
40
+     * @var bool
41
+     */
42 42
     protected $future = false;
43 43
     
44
-   /**
45
-    * @var string
46
-    */
44
+    /**
45
+     * @var string
46
+     */
47 47
     protected $interval = '';
48 48
     
49
-   /**
50
-    * @var int
51
-    */
49
+    /**
50
+     * @var int
51
+     */
52 52
     protected $difference = 0;
53 53
     
54
-   /**
55
-    * @var int
56
-    */
54
+    /**
55
+     * @var int
56
+     */
57 57
     protected $dateDiff = 0;
58 58
     
59
-   /**
60
-    * @var array|NULL
61
-    */
59
+    /**
60
+     * @var array|NULL
61
+     */
62 62
     protected static $texts = null;
63 63
     
64 64
     public function __construct()
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
         self::$texts = null;
79 79
     }
80 80
     
81
-   /**
82
-    * Sets the origin date to calculate from.
83
-    * 
84
-    * NOTE: if this is further in the future than
85
-    * the to: date, it will be considered as a 
86
-    * calculation for something to come, i.e. 
87
-    * "In two days".
88
-    *  
89
-    * @param \DateTime $date
90
-    * @return ConvertHelper_DurationConverter
91
-    */
81
+    /**
82
+     * Sets the origin date to calculate from.
83
+     * 
84
+     * NOTE: if this is further in the future than
85
+     * the to: date, it will be considered as a 
86
+     * calculation for something to come, i.e. 
87
+     * "In two days".
88
+     *  
89
+     * @param \DateTime $date
90
+     * @return ConvertHelper_DurationConverter
91
+     */
92 92
     public function setDateFrom(\DateTime $date) : ConvertHelper_DurationConverter
93 93
     {
94 94
         $this->dateFrom = ConvertHelper::date2timestamp($date);
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
         return $this;
97 97
     }
98 98
     
99
-   /**
100
-    * Sets the date to calculate to. Defaults to 
101
-    * the current time if not set.
102
-    * 
103
-    * @param \DateTime $date
104
-    * @return ConvertHelper_DurationConverter
105
-    */
99
+    /**
100
+     * Sets the date to calculate to. Defaults to 
101
+     * the current time if not set.
102
+     * 
103
+     * @param \DateTime $date
104
+     * @return ConvertHelper_DurationConverter
105
+     */
106 106
     public function setDateTo(\DateTime $date) : ConvertHelper_DurationConverter
107 107
     {
108 108
         $this->dateTo = ConvertHelper::date2timestamp($date);
@@ -110,14 +110,14 @@  discard block
 block discarded – undo
110 110
         return $this;
111 111
     }
112 112
     
113
-   /**
114
-    * Converts the specified dates to a human readable string.
115
-    * 
116
-    * @throws ConvertHelper_Exception
117
-    * @return string
118
-    * 
119
-    * @see ConvertHelper_DurationConverter::ERROR_NO_DATE_FROM_SET
120
-    */
113
+    /**
114
+     * Converts the specified dates to a human readable string.
115
+     * 
116
+     * @throws ConvertHelper_Exception
117
+     * @return string
118
+     * 
119
+     * @see ConvertHelper_DurationConverter::ERROR_NO_DATE_FROM_SET
120
+     */
121 121
     public function convert() : string
122 122
     {
123 123
         $this->initTexts();
Please login to merge, or discard this patch.
src/ConvertHelper/StorageSizeEnum.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -31,17 +31,17 @@  discard block
 block discarded – undo
31 31
     
32 32
     const BASE_2 = 1024;
33 33
     
34
-   /**
35
-    * @var ConvertHelper_StorageSizeEnum_Size[]|NULL
36
-    */
34
+    /**
35
+     * @var ConvertHelper_StorageSizeEnum_Size[]|NULL
36
+     */
37 37
     protected static $sizes = null;
38 38
     
39
-   /**
40
-    * Initializes the supported unit notations, and
41
-    * how they are supposed to be calculated.
42
-    *
43
-    * @see ConvertHelper_SizeNotation::parseSize()
44
-    */
39
+    /**
40
+     * Initializes the supported unit notations, and
41
+     * how they are supposed to be calculated.
42
+     *
43
+     * @see ConvertHelper_SizeNotation::parseSize()
44
+     */
45 45
     protected static function init()
46 46
     {
47 47
         if(isset(self::$sizes)) {
@@ -70,30 +70,30 @@  discard block
 block discarded – undo
70 70
         }
71 71
     }
72 72
     
73
-   /**
74
-    * Called whenever the application locale is changed,
75
-    * to reset the size definitions so the labels get 
76
-    * translated to the new locale.
77
-    * 
78
-    * @param \AppLocalize\Localization_Event_LocaleChanged $event
79
-    */
73
+    /**
74
+     * Called whenever the application locale is changed,
75
+     * to reset the size definitions so the labels get 
76
+     * translated to the new locale.
77
+     * 
78
+     * @param \AppLocalize\Localization_Event_LocaleChanged $event
79
+     */
80 80
     public static function handle_localeChanged(\AppLocalize\Localization_Event_LocaleChanged $event)
81 81
     {
82 82
         self::$sizes = null;
83 83
     }
84 84
     
85
-   /**
86
-    * Adds a storage size to the internal collection.
87
-    * 
88
-    * @param string $name The lowercase size name, e.g. "kb", "mib"
89
-    * @param int $base This defines how many bytes there are in a kilobyte, to differentiate with the two common way to calculate sizes: base 10 or base 2. See the Wikipedia link for more details.
90
-    * @param int $exponent The multiplier of the base to get the byte value
91
-    * @param string $suffix The localized short suffix, e.g. "KB", "MiB"
92
-    * @param string $singular The localized singular label of the size, e.g. "Kilobyte".
93
-    * @param string $plural The localized plural label of the size, e.g. "Kilobytes".
94
-    * 
95
-    * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions
96
-    */
85
+    /**
86
+     * Adds a storage size to the internal collection.
87
+     * 
88
+     * @param string $name The lowercase size name, e.g. "kb", "mib"
89
+     * @param int $base This defines how many bytes there are in a kilobyte, to differentiate with the two common way to calculate sizes: base 10 or base 2. See the Wikipedia link for more details.
90
+     * @param int $exponent The multiplier of the base to get the byte value
91
+     * @param string $suffix The localized short suffix, e.g. "KB", "MiB"
92
+     * @param string $singular The localized singular label of the size, e.g. "Kilobyte".
93
+     * @param string $plural The localized plural label of the size, e.g. "Kilobytes".
94
+     * 
95
+     * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions
96
+     */
97 97
     protected static function addSize(string $name, int $base, int $exponent, string $suffix, string $singular, string $plural)
98 98
     {
99 99
         self::$sizes[$name] = new ConvertHelper_StorageSizeEnum_Size(
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
         );
107 107
     }
108 108
     
109
-   /**
110
-    * Retrieves all known sizes.
111
-    * 
112
-    * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[]
113
-    */
109
+    /**
110
+     * Retrieves all known sizes.
111
+     * 
112
+     * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[]
113
+     */
114 114
     public static function getSizes()
115 115
     {
116 116
         self::init();
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
         return self::$sizes;
119 119
     }
120 120
     
121
-   /**
122
-    * Retrieves a size definition instance by its name.
123
-    * 
124
-    * @param string $name Case insensitive. For example "kb", "MiB"...
125
-    * @throws ConvertHelper_Exception
126
-    * @return ConvertHelper_StorageSizeEnum_Size
127
-    * 
128
-    * @see ConvertHelper_StorageSizeEnum::ERROR_UNKNOWN_UNIT_NAME
129
-    */
121
+    /**
122
+     * Retrieves a size definition instance by its name.
123
+     * 
124
+     * @param string $name Case insensitive. For example "kb", "MiB"...
125
+     * @throws ConvertHelper_Exception
126
+     * @return ConvertHelper_StorageSizeEnum_Size
127
+     * 
128
+     * @see ConvertHelper_StorageSizeEnum::ERROR_UNKNOWN_UNIT_NAME
129
+     */
130 130
     public static function getSizeByName(string $name) : ConvertHelper_StorageSizeEnum_Size
131 131
     {
132 132
         self::init();
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
         );
149 149
     }
150 150
     
151
-   /**
152
-    * Retrieves a list of all size names, e.g. "mb", "kib" (lowercase).
153
-    * @return array
154
-    */
151
+    /**
152
+     * Retrieves a list of all size names, e.g. "mb", "kib" (lowercase).
153
+     * @return array
154
+     */
155 155
     public static function getSizeNames() : array
156 156
     {
157 157
         self::init();
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
         return array_keys(self::$sizes);
160 160
     }
161 161
    
162
-   /**
163
-    * Retrieves all available storage sizes for the specified
164
-    * base value.
165
-    * 
166
-    * @param int $base
167
-    * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[]
168
-    * 
169
-    * @see ConvertHelper_StorageSizeEnum::BASE_10
170
-    * @see ConvertHelper_StorageSizeEnum::BASE_2
171
-    */
162
+    /**
163
+     * Retrieves all available storage sizes for the specified
164
+     * base value.
165
+     * 
166
+     * @param int $base
167
+     * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[]
168
+     * 
169
+     * @see ConvertHelper_StorageSizeEnum::BASE_10
170
+     * @see ConvertHelper_StorageSizeEnum::BASE_2
171
+     */
172 172
     public static function getSizesByBase(int $base)
173 173
     {
174 174
         self::init();
Please login to merge, or discard this patch.
src/RequestHelper.php 1 patch
Indentation   +98 added lines, -98 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();
@@ -279,13 +279,13 @@  discard block
 block discarded – undo
279 279
         return $ch;
280 280
     }
281 281
 
282
-   /**
283
-    * Compiles the associative headers array into
284
-    * the format understood by CURL, namely an indexed
285
-    * array with one header string per entry.
286
-    * 
287
-    * @return array
288
-    */
282
+    /**
283
+     * Compiles the associative headers array into
284
+     * the format understood by CURL, namely an indexed
285
+     * array with one header string per entry.
286
+     * 
287
+     * @return array
288
+     */
289 289
     protected function renderHeaders() : array
290 290
     {
291 291
         $result = array();
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
         return $result;
298 298
     }
299 299
     
300
-   /**
301
-    * Retrieves the raw response header, in the form of an indexed
302
-    * array containing all response header lines.
303
-    * 
304
-    * @return array
305
-    */
300
+    /**
301
+     * Retrieves the raw response header, in the form of an indexed
302
+     * array containing all response header lines.
303
+     * 
304
+     * @return array
305
+     */
306 306
     public function getResponseHeader() : array
307 307
     {
308 308
         $response = $this->getResponse();
Please login to merge, or discard this patch.