@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | const VALIDATION_ERROR_NEGATIVE_VALUE = 43803; |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @var string |
|
| 36 | - */ |
|
| 34 | + /** |
|
| 35 | + * @var string |
|
| 36 | + */ |
|
| 37 | 37 | protected $sizeString; |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -41,41 +41,41 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | protected $sizeDefinition; |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @var integer |
|
| 46 | - */ |
|
| 44 | + /** |
|
| 45 | + * @var integer |
|
| 46 | + */ |
|
| 47 | 47 | protected $bytes = 0; |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @var bool |
|
| 51 | - */ |
|
| 49 | + /** |
|
| 50 | + * @var bool |
|
| 51 | + */ |
|
| 52 | 52 | protected $valid = true; |
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * @var string |
|
| 56 | - */ |
|
| 54 | + /** |
|
| 55 | + * @var string |
|
| 56 | + */ |
|
| 57 | 57 | protected $units = null; |
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * @var string |
|
| 61 | - */ |
|
| 59 | + /** |
|
| 60 | + * @var string |
|
| 61 | + */ |
|
| 62 | 62 | protected $number = ''; |
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * @var string |
|
| 66 | - */ |
|
| 64 | + /** |
|
| 65 | + * @var string |
|
| 66 | + */ |
|
| 67 | 67 | protected $errorMessage = ''; |
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * @var int |
|
| 71 | - */ |
|
| 69 | + /** |
|
| 70 | + * @var int |
|
| 71 | + */ |
|
| 72 | 72 | protected $errorCode = 0; |
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Create a new instance for the specified size string. |
|
| 76 | - * |
|
| 77 | - * @param string $sizeString A size notation in the format "50 MB", or a number of bytes without units. Spaces are ignored, so "50MB" = "50 MB" = " 50 MB ". Floating point values are accepted, both with dot and comma notation ("50.5" = "50,5"). To use Base 2 values, ose appropriate units, e.g. "50 MiB", "1.5 GiB". The units are case insensitive, so "50 MB" = "50 mb". |
|
| 78 | - */ |
|
| 74 | + /** |
|
| 75 | + * Create a new instance for the specified size string. |
|
| 76 | + * |
|
| 77 | + * @param string $sizeString A size notation in the format "50 MB", or a number of bytes without units. Spaces are ignored, so "50MB" = "50 MB" = " 50 MB ". Floating point values are accepted, both with dot and comma notation ("50.5" = "50,5"). To use Base 2 values, ose appropriate units, e.g. "50 MiB", "1.5 GiB". The units are case insensitive, so "50 MB" = "50 mb". |
|
| 78 | + */ |
|
| 79 | 79 | public function __construct(string $sizeString) |
| 80 | 80 | { |
| 81 | 81 | $this->sizeString = $this->cleanString($sizeString); |
@@ -83,31 +83,31 @@ discard block |
||
| 83 | 83 | $this->convert(); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * Gets the amount of bytes contained in the size notation. |
|
| 88 | - * @return int |
|
| 89 | - */ |
|
| 86 | + /** |
|
| 87 | + * Gets the amount of bytes contained in the size notation. |
|
| 88 | + * @return int |
|
| 89 | + */ |
|
| 90 | 90 | public function toBytes() : int |
| 91 | 91 | { |
| 92 | 92 | return $this->bytes; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * Converts the size notation to a human readable string, e.g. "50 MB". |
|
| 97 | - * |
|
| 98 | - * @param int $precision |
|
| 99 | - * @return string |
|
| 100 | - * @see ConvertHelper::bytes2readable() |
|
| 101 | - */ |
|
| 95 | + /** |
|
| 96 | + * Converts the size notation to a human readable string, e.g. "50 MB". |
|
| 97 | + * |
|
| 98 | + * @param int $precision |
|
| 99 | + * @return string |
|
| 100 | + * @see ConvertHelper::bytes2readable() |
|
| 101 | + */ |
|
| 102 | 102 | public function toString(int $precision=1) : string |
| 103 | 103 | { |
| 104 | 104 | return ConvertHelper::bytes2readable($this->bytes, $precision, $this->getBase()); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Retrieves the detected number's base. |
|
| 109 | - * @return int The base number (1000 for Base 10, or 1024 for Base 2), or 0 if it is not valid. |
|
| 110 | - */ |
|
| 107 | + /** |
|
| 108 | + * Retrieves the detected number's base. |
|
| 109 | + * @return int The base number (1000 for Base 10, or 1024 for Base 2), or 0 if it is not valid. |
|
| 110 | + */ |
|
| 111 | 111 | public function getBase() : int |
| 112 | 112 | { |
| 113 | 113 | if($this->isValid()) { |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | return 0; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - /** |
|
| 121 | - * Retrieves the detected storage size instance, if |
|
| 122 | - * the size string is valid. |
|
| 123 | - * |
|
| 124 | - * @return ConvertHelper_StorageSizeEnum_Size|NULL |
|
| 125 | - * @see ConvertHelper_StorageSizeEnum_Size |
|
| 126 | - */ |
|
| 120 | + /** |
|
| 121 | + * Retrieves the detected storage size instance, if |
|
| 122 | + * the size string is valid. |
|
| 123 | + * |
|
| 124 | + * @return ConvertHelper_StorageSizeEnum_Size|NULL |
|
| 125 | + * @see ConvertHelper_StorageSizeEnum_Size |
|
| 126 | + */ |
|
| 127 | 127 | public function getSizeDefinition() : ?ConvertHelper_StorageSizeEnum_Size |
| 128 | 128 | { |
| 129 | 129 | if($this->isValid()) { |
@@ -133,27 +133,27 @@ discard block |
||
| 133 | 133 | return null; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * Checks whether the size notation was valid and could be parsed |
|
| 138 | - * into a meaningful byte value. If this returns `false`, it is |
|
| 139 | - * possible to use the `getErrorXXX` methods to retrieve information |
|
| 140 | - * on what went wrong. |
|
| 141 | - * |
|
| 142 | - * @return bool |
|
| 143 | - * @see ConvertHelper_SizeNotation::getErrorMessage() |
|
| 144 | - * @see ConvertHelper_SizeNotation::getErrorCode() |
|
| 145 | - */ |
|
| 136 | + /** |
|
| 137 | + * Checks whether the size notation was valid and could be parsed |
|
| 138 | + * into a meaningful byte value. If this returns `false`, it is |
|
| 139 | + * possible to use the `getErrorXXX` methods to retrieve information |
|
| 140 | + * on what went wrong. |
|
| 141 | + * |
|
| 142 | + * @return bool |
|
| 143 | + * @see ConvertHelper_SizeNotation::getErrorMessage() |
|
| 144 | + * @see ConvertHelper_SizeNotation::getErrorCode() |
|
| 145 | + */ |
|
| 146 | 146 | public function isValid() : bool |
| 147 | 147 | { |
| 148 | 148 | return $this->valid; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - /** |
|
| 152 | - * Retrieves the error message if the size notation validation failed. |
|
| 153 | - * |
|
| 154 | - * @return string |
|
| 155 | - * @see ConvertHelper_SizeNotation::getErrorCode() |
|
| 156 | - */ |
|
| 151 | + /** |
|
| 152 | + * Retrieves the error message if the size notation validation failed. |
|
| 153 | + * |
|
| 154 | + * @return string |
|
| 155 | + * @see ConvertHelper_SizeNotation::getErrorCode() |
|
| 156 | + */ |
|
| 157 | 157 | public function getErrorMessage() : string |
| 158 | 158 | { |
| 159 | 159 | return $this->errorMessage; |
@@ -200,12 +200,12 @@ discard block |
||
| 200 | 200 | ); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - /** |
|
| 204 | - * Detects the units and the number in the size notation string. |
|
| 205 | - * Populates the `units` and `number` properties. |
|
| 206 | - * |
|
| 207 | - * @return bool Whether the string could be parsed successfully. |
|
| 208 | - */ |
|
| 203 | + /** |
|
| 204 | + * Detects the units and the number in the size notation string. |
|
| 205 | + * Populates the `units` and `number` properties. |
|
| 206 | + * |
|
| 207 | + * @return bool Whether the string could be parsed successfully. |
|
| 208 | + */ |
|
| 209 | 209 | protected function detectParts() : bool |
| 210 | 210 | { |
| 211 | 211 | $units = ConvertHelper_StorageSizeEnum::getSizeNames(); |
@@ -241,16 +241,16 @@ discard block |
||
| 241 | 241 | return true; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - /** |
|
| 245 | - * If the validation fails, this is used to store the reason for retrieval later. |
|
| 246 | - * |
|
| 247 | - * @param string $message |
|
| 248 | - * @param int $code |
|
| 249 | - * |
|
| 250 | - * @see ConvertHelper_SizeNotation::isValid() |
|
| 251 | - * @see ConvertHelper_SizeNotation::getErrorMessage() |
|
| 252 | - * @see ConvertHelper_SizeNotation::getErrorCode() |
|
| 253 | - */ |
|
| 244 | + /** |
|
| 245 | + * If the validation fails, this is used to store the reason for retrieval later. |
|
| 246 | + * |
|
| 247 | + * @param string $message |
|
| 248 | + * @param int $code |
|
| 249 | + * |
|
| 250 | + * @see ConvertHelper_SizeNotation::isValid() |
|
| 251 | + * @see ConvertHelper_SizeNotation::getErrorMessage() |
|
| 252 | + * @see ConvertHelper_SizeNotation::getErrorCode() |
|
| 253 | + */ |
|
| 254 | 254 | protected function setError(string $message, int $code) : void |
| 255 | 255 | { |
| 256 | 256 | $this->valid = false; |
@@ -258,12 +258,12 @@ discard block |
||
| 258 | 258 | $this->errorCode = $code; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - /** |
|
| 262 | - * Retrieves the error code, if the size notation validation failed. |
|
| 263 | - * |
|
| 264 | - * @return int |
|
| 265 | - * @see ConvertHelper_SizeNotation::getErrorMessage() |
|
| 266 | - */ |
|
| 261 | + /** |
|
| 262 | + * Retrieves the error code, if the size notation validation failed. |
|
| 263 | + * |
|
| 264 | + * @return int |
|
| 265 | + * @see ConvertHelper_SizeNotation::getErrorMessage() |
|
| 266 | + */ |
|
| 267 | 267 | public function getErrorCode() : int |
| 268 | 268 | { |
| 269 | 269 | return $this->errorCode; |
@@ -39,9 +39,9 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -124,12 +124,12 @@ discard block |
||
| 124 | 124 | return $this->buildURL($params, $dispatcher); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * Retrieves the name of the current dispatcher script / page. |
|
| 129 | - * This is made to be extended and implemented in a subclass. |
|
| 130 | - * |
|
| 131 | - * @return string |
|
| 132 | - */ |
|
| 127 | + /** |
|
| 128 | + * Retrieves the name of the current dispatcher script / page. |
|
| 129 | + * This is made to be extended and implemented in a subclass. |
|
| 130 | + * |
|
| 131 | + * @return string |
|
| 132 | + */ |
|
| 133 | 133 | public function getDispatcher() : string |
| 134 | 134 | { |
| 135 | 135 | return ''; |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | return $url; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - /** |
|
| 202 | - * Retrieves the base URL of the application. |
|
| 203 | - * @return string |
|
| 204 | - */ |
|
| 201 | + /** |
|
| 202 | + * Retrieves the base URL of the application. |
|
| 203 | + * @return string |
|
| 204 | + */ |
|
| 205 | 205 | public function getBaseURL() : string |
| 206 | 206 | { |
| 207 | 207 | return $this->baseURL; |
@@ -231,13 +231,13 @@ discard block |
||
| 231 | 231 | return $this->knownParams[$name]; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - /** |
|
| 235 | - * Retrieves a previously registered parameter instance. |
|
| 236 | - * |
|
| 237 | - * @param string $name |
|
| 238 | - * @throws Request_Exception |
|
| 239 | - * @return Request_Param |
|
| 240 | - */ |
|
| 234 | + /** |
|
| 235 | + * Retrieves a previously registered parameter instance. |
|
| 236 | + * |
|
| 237 | + * @param string $name |
|
| 238 | + * @throws Request_Exception |
|
| 239 | + * @return Request_Param |
|
| 240 | + */ |
|
| 241 | 241 | public function getRegisteredParam(string $name) : Request_Param |
| 242 | 242 | { |
| 243 | 243 | if(isset($this->knownParams[$name])) { |
@@ -254,48 +254,48 @@ discard block |
||
| 254 | 254 | ); |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - /** |
|
| 258 | - * Checks whether a parameter with the specified name |
|
| 259 | - * has been registered. |
|
| 260 | - * |
|
| 261 | - * @param string $name |
|
| 262 | - * @return bool |
|
| 263 | - */ |
|
| 257 | + /** |
|
| 258 | + * Checks whether a parameter with the specified name |
|
| 259 | + * has been registered. |
|
| 260 | + * |
|
| 261 | + * @param string $name |
|
| 262 | + * @return bool |
|
| 263 | + */ |
|
| 264 | 264 | public function hasRegisteredParam(string $name) : bool |
| 265 | 265 | { |
| 266 | 266 | return isset($this->knownParams[$name]); |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - /** |
|
| 270 | - * Retrieves an indexed array with accept mime types |
|
| 271 | - * that the client sent, in the order of preference |
|
| 272 | - * the client specified. |
|
| 273 | - * |
|
| 274 | - * Example: |
|
| 275 | - * |
|
| 276 | - * array( |
|
| 277 | - * 'text/html', |
|
| 278 | - * 'application/xhtml+xml', |
|
| 279 | - * 'image/webp' |
|
| 280 | - * ... |
|
| 281 | - * ) |
|
| 282 | - * |
|
| 283 | - * @return array |
|
| 284 | - * @see Request::parseAcceptHeaders() |
|
| 285 | - */ |
|
| 269 | + /** |
|
| 270 | + * Retrieves an indexed array with accept mime types |
|
| 271 | + * that the client sent, in the order of preference |
|
| 272 | + * the client specified. |
|
| 273 | + * |
|
| 274 | + * Example: |
|
| 275 | + * |
|
| 276 | + * array( |
|
| 277 | + * 'text/html', |
|
| 278 | + * 'application/xhtml+xml', |
|
| 279 | + * 'image/webp' |
|
| 280 | + * ... |
|
| 281 | + * ) |
|
| 282 | + * |
|
| 283 | + * @return array |
|
| 284 | + * @see Request::parseAcceptHeaders() |
|
| 285 | + */ |
|
| 286 | 286 | public static function getAcceptHeaders() : array |
| 287 | 287 | { |
| 288 | 288 | return self::parseAcceptHeaders()->getMimeStrings(); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - /** |
|
| 292 | - * Returns an instance of the accept headers parser, |
|
| 293 | - * to access information on the browser's accepted |
|
| 294 | - * mime types. |
|
| 295 | - * |
|
| 296 | - * @return Request_AcceptHeaders |
|
| 297 | - * @see Request::getAcceptHeaders() |
|
| 298 | - */ |
|
| 291 | + /** |
|
| 292 | + * Returns an instance of the accept headers parser, |
|
| 293 | + * to access information on the browser's accepted |
|
| 294 | + * mime types. |
|
| 295 | + * |
|
| 296 | + * @return Request_AcceptHeaders |
|
| 297 | + * @see Request::getAcceptHeaders() |
|
| 298 | + */ |
|
| 299 | 299 | public static function parseAcceptHeaders() : Request_AcceptHeaders |
| 300 | 300 | { |
| 301 | 301 | static $accept; |
@@ -343,14 +343,14 @@ discard block |
||
| 343 | 343 | return false; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - /** |
|
| 347 | - * Removes a single parameter from the request. |
|
| 348 | - * If the parameter has been registered, also |
|
| 349 | - * removes the registration info. |
|
| 350 | - * |
|
| 351 | - * @param string $name |
|
| 352 | - * @return Request |
|
| 353 | - */ |
|
| 346 | + /** |
|
| 347 | + * Removes a single parameter from the request. |
|
| 348 | + * If the parameter has been registered, also |
|
| 349 | + * removes the registration info. |
|
| 350 | + * |
|
| 351 | + * @param string $name |
|
| 352 | + * @return Request |
|
| 353 | + */ |
|
| 354 | 354 | public function removeParam(string $name) : Request |
| 355 | 355 | { |
| 356 | 356 | if(isset($_REQUEST[$name])) { |
@@ -364,12 +364,12 @@ discard block |
||
| 364 | 364 | return $this; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - /** |
|
| 368 | - * Removes several parameters from the request. |
|
| 369 | - * |
|
| 370 | - * @param string[] $names |
|
| 371 | - * @return Request |
|
| 372 | - */ |
|
| 367 | + /** |
|
| 368 | + * Removes several parameters from the request. |
|
| 369 | + * |
|
| 370 | + * @param string[] $names |
|
| 371 | + * @return Request |
|
| 372 | + */ |
|
| 373 | 373 | public function removeParams(array $names) : Request |
| 374 | 374 | { |
| 375 | 375 | foreach($names as $name) { |
@@ -434,18 +434,18 @@ discard block |
||
| 434 | 434 | return $val; |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | - /** |
|
| 438 | - * Treats the request parameter as a JSON string, and |
|
| 439 | - * if it exists and contains valid JSON, returns the |
|
| 440 | - * decoded JSON value as an array (default). |
|
| 441 | - * |
|
| 442 | - * @param string $name |
|
| 443 | - * @param bool $assoc |
|
| 444 | - * @return array|object |
|
| 445 | - * |
|
| 446 | - * @see Request::getJSONAssoc() |
|
| 447 | - * @see Request::getJSONObject() |
|
| 448 | - */ |
|
| 437 | + /** |
|
| 438 | + * Treats the request parameter as a JSON string, and |
|
| 439 | + * if it exists and contains valid JSON, returns the |
|
| 440 | + * decoded JSON value as an array (default). |
|
| 441 | + * |
|
| 442 | + * @param string $name |
|
| 443 | + * @param bool $assoc |
|
| 444 | + * @return array|object |
|
| 445 | + * |
|
| 446 | + * @see Request::getJSONAssoc() |
|
| 447 | + * @see Request::getJSONObject() |
|
| 448 | + */ |
|
| 449 | 449 | public function getJSON(string $name, bool $assoc=true) |
| 450 | 450 | { |
| 451 | 451 | $value = $this->getParam($name); |
@@ -470,13 +470,13 @@ discard block |
||
| 470 | 470 | return new \stdClass(); |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - /** |
|
| 474 | - * Like {@link Request::getJSON()}, but omitting the second |
|
| 475 | - * parameter. Use this for more readable code. |
|
| 476 | - * |
|
| 477 | - * @param string $name |
|
| 478 | - * @return array |
|
| 479 | - */ |
|
| 473 | + /** |
|
| 474 | + * Like {@link Request::getJSON()}, but omitting the second |
|
| 475 | + * parameter. Use this for more readable code. |
|
| 476 | + * |
|
| 477 | + * @param string $name |
|
| 478 | + * @return array |
|
| 479 | + */ |
|
| 480 | 480 | public function getJSONAssoc(string $name) : array |
| 481 | 481 | { |
| 482 | 482 | $result = $this->getJSON($name); |
@@ -487,13 +487,13 @@ discard block |
||
| 487 | 487 | return array(); |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - /** |
|
| 491 | - * Like {@link Request::getJSON()}, but omitting the second |
|
| 492 | - * parameter. Use this for more readable code. |
|
| 493 | - * |
|
| 494 | - * @param string $name |
|
| 495 | - * @return object |
|
| 496 | - */ |
|
| 490 | + /** |
|
| 491 | + * Like {@link Request::getJSON()}, but omitting the second |
|
| 492 | + * parameter. Use this for more readable code. |
|
| 493 | + * |
|
| 494 | + * @param string $name |
|
| 495 | + * @return object |
|
| 496 | + */ |
|
| 497 | 497 | public function getJSONObject(string $name) : object |
| 498 | 498 | { |
| 499 | 499 | $result = $this->getJSON($name, false); |
@@ -504,12 +504,12 @@ discard block |
||
| 504 | 504 | return new \stdClass(); |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | - /** |
|
| 508 | - * Sends a JSON response with the correct headers. |
|
| 509 | - * |
|
| 510 | - * @param array|string $data |
|
| 511 | - * @param bool $exit Whether to exit the script afterwards. |
|
| 512 | - */ |
|
| 507 | + /** |
|
| 508 | + * Sends a JSON response with the correct headers. |
|
| 509 | + * |
|
| 510 | + * @param array|string $data |
|
| 511 | + * @param bool $exit Whether to exit the script afterwards. |
|
| 512 | + */ |
|
| 513 | 513 | public static function sendJSON($data, bool $exit=true) |
| 514 | 514 | { |
| 515 | 515 | $payload = $data; |
@@ -529,12 +529,12 @@ discard block |
||
| 529 | 529 | } |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | - /** |
|
| 533 | - * Sends HTML to the browser with the correct headers. |
|
| 534 | - * |
|
| 535 | - * @param string $html |
|
| 536 | - * @param bool $exit Whether to exit the script afterwards. |
|
| 537 | - */ |
|
| 532 | + /** |
|
| 533 | + * Sends HTML to the browser with the correct headers. |
|
| 534 | + * |
|
| 535 | + * @param string $html |
|
| 536 | + * @param bool $exit Whether to exit the script afterwards. |
|
| 537 | + */ |
|
| 538 | 538 | public static function sendHTML(string $html, bool $exit=true) |
| 539 | 539 | { |
| 540 | 540 | header('Cache-Control: no-cache, must-revalidate'); |
@@ -549,16 +549,16 @@ discard block |
||
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | - /** |
|
| 553 | - * Creates a new instance of the URL comparer, which can check |
|
| 554 | - * whether the specified URLs match, regardless of the order in |
|
| 555 | - * which the query parameters are, if any. |
|
| 556 | - * |
|
| 557 | - * @param string $sourceURL |
|
| 558 | - * @param string $targetURL |
|
| 559 | - * @param array $limitParams Whether to limit the comparison to these specific parameter names (if present) |
|
| 560 | - * @return Request_URLComparer |
|
| 561 | - */ |
|
| 552 | + /** |
|
| 553 | + * Creates a new instance of the URL comparer, which can check |
|
| 554 | + * whether the specified URLs match, regardless of the order in |
|
| 555 | + * which the query parameters are, if any. |
|
| 556 | + * |
|
| 557 | + * @param string $sourceURL |
|
| 558 | + * @param string $targetURL |
|
| 559 | + * @param array $limitParams Whether to limit the comparison to these specific parameter names (if present) |
|
| 560 | + * @return Request_URLComparer |
|
| 561 | + */ |
|
| 562 | 562 | public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams=array()) : Request_URLComparer |
| 563 | 563 | { |
| 564 | 564 | $comparer = new Request_URLComparer($this, $sourceURL, $targetURL); |
@@ -567,10 +567,10 @@ discard block |
||
| 567 | 567 | return $comparer; |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | - /** |
|
| 571 | - * Retrieves the full URL that was used to access the current page. |
|
| 572 | - * @return string |
|
| 573 | - */ |
|
| 570 | + /** |
|
| 571 | + * Retrieves the full URL that was used to access the current page. |
|
| 572 | + * @return string |
|
| 573 | + */ |
|
| 574 | 574 | public function getCurrentURL() : string |
| 575 | 575 | { |
| 576 | 576 | return $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
@@ -28,20 +28,20 @@ discard block |
||
| 28 | 28 | $this->parse(); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Retrieves an indexed array with accept mime types |
|
| 33 | - * that the client sent, in the order of preference |
|
| 34 | - * the client specified. |
|
| 35 | - * |
|
| 36 | - * Example: |
|
| 37 | - * |
|
| 38 | - * array( |
|
| 39 | - * 'text/html', |
|
| 40 | - * 'application/xhtml+xml', |
|
| 41 | - * 'image/webp' |
|
| 42 | - * ... |
|
| 43 | - * ) |
|
| 44 | - */ |
|
| 31 | + /** |
|
| 32 | + * Retrieves an indexed array with accept mime types |
|
| 33 | + * that the client sent, in the order of preference |
|
| 34 | + * the client specified. |
|
| 35 | + * |
|
| 36 | + * Example: |
|
| 37 | + * |
|
| 38 | + * array( |
|
| 39 | + * 'text/html', |
|
| 40 | + * 'application/xhtml+xml', |
|
| 41 | + * 'image/webp' |
|
| 42 | + * ... |
|
| 43 | + * ) |
|
| 44 | + */ |
|
| 45 | 45 | public function getMimeStrings() : array |
| 46 | 46 | { |
| 47 | 47 | $result = array(); |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | return $result; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Checks that an accept header string exists, and tries to parse it. |
|
| 59 | - */ |
|
| 57 | + /** |
|
| 58 | + * Checks that an accept header string exists, and tries to parse it. |
|
| 59 | + */ |
|
| 60 | 60 | protected function parse() : void |
| 61 | 61 | { |
| 62 | 62 | // we may be in a CLI environment where the headers |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | $this->headers = $this->parseHeader($_SERVER['HTTP_ACCEPT']); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Splits the accept header string and parses the mime types. |
|
| 73 | - * |
|
| 74 | - * @param string $acceptHeader |
|
| 75 | - */ |
|
| 71 | + /** |
|
| 72 | + * Splits the accept header string and parses the mime types. |
|
| 73 | + * |
|
| 74 | + * @param string $acceptHeader |
|
| 75 | + */ |
|
| 76 | 76 | protected function parseHeader(string $acceptHeader) : array |
| 77 | 77 | { |
| 78 | 78 | $tokens = preg_split('/\s*,\s*/', $acceptHeader); |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | return $accept; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Parses a single mime type entry. |
|
| 94 | - * |
|
| 95 | - * @param int $i The position in the accept string |
|
| 96 | - * @param string $mime The mime type |
|
| 97 | - * @return array |
|
| 98 | - */ |
|
| 92 | + /** |
|
| 93 | + * Parses a single mime type entry. |
|
| 94 | + * |
|
| 95 | + * @param int $i The position in the accept string |
|
| 96 | + * @param string $mime The mime type |
|
| 97 | + * @return array |
|
| 98 | + */ |
|
| 99 | 99 | protected function parseEntry(int $i, string $mime) : array |
| 100 | 100 | { |
| 101 | 101 | $entry = array( |
@@ -125,14 +125,14 @@ discard block |
||
| 125 | 125 | return $entry; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - /** |
|
| 129 | - * Sorts the mime types collection, first by quality |
|
| 130 | - * and then by position in the list. |
|
| 131 | - * |
|
| 132 | - * @param array $a |
|
| 133 | - * @param array $b |
|
| 134 | - * @return number |
|
| 135 | - */ |
|
| 128 | + /** |
|
| 129 | + * Sorts the mime types collection, first by quality |
|
| 130 | + * and then by position in the list. |
|
| 131 | + * |
|
| 132 | + * @param array $a |
|
| 133 | + * @param array $b |
|
| 134 | + * @return number |
|
| 135 | + */ |
|
| 136 | 136 | protected function sortMimeTypes(array $a, array $b) |
| 137 | 137 | { |
| 138 | 138 | /* first tier: highest q factor wins */ |
@@ -22,9 +22,9 @@ |
||
| 22 | 22 | { |
| 23 | 23 | use Traits_Optionable; |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @var Request_Param |
|
| 27 | - */ |
|
| 25 | + /** |
|
| 26 | + * @var Request_Param |
|
| 27 | + */ |
|
| 28 | 28 | protected $param; |
| 29 | 29 | |
| 30 | 30 | protected $value; |
@@ -6,9 +6,9 @@ |
||
| 6 | 6 | |
| 7 | 7 | abstract class VariableInfo_Renderer_String extends VariableInfo_Renderer |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @var mixed |
|
| 11 | - */ |
|
| 9 | + /** |
|
| 10 | + * @var mixed |
|
| 11 | + */ |
|
| 12 | 12 | protected $value; |
| 13 | 13 | |
| 14 | 14 | protected function init() |
@@ -6,19 +6,19 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | abstract class VariableInfo_Renderer |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @var mixed |
|
| 11 | - */ |
|
| 9 | + /** |
|
| 10 | + * @var mixed |
|
| 11 | + */ |
|
| 12 | 12 | protected $value; |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * @var VariableInfo |
|
| 16 | - */ |
|
| 14 | + /** |
|
| 15 | + * @var VariableInfo |
|
| 16 | + */ |
|
| 17 | 17 | protected $info; |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var string |
|
| 21 | - */ |
|
| 19 | + /** |
|
| 20 | + * @var string |
|
| 21 | + */ |
|
| 22 | 22 | protected $type; |
| 23 | 23 | |
| 24 | 24 | public function __construct(VariableInfo $info) |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | abstract protected function init(); |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Renders the value to the target format. |
|
| 36 | - * |
|
| 37 | - * @return mixed |
|
| 38 | - */ |
|
| 34 | + /** |
|
| 35 | + * Renders the value to the target format. |
|
| 36 | + * |
|
| 37 | + * @return mixed |
|
| 38 | + */ |
|
| 39 | 39 | public function render() |
| 40 | 40 | { |
| 41 | 41 | return $this->_render(); |
@@ -21,25 +21,25 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | class XMLHelper_Converter_Decorator implements \JsonSerializable |
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * @var \SimpleXMLElement |
|
| 26 | - */ |
|
| 24 | + /** |
|
| 25 | + * @var \SimpleXMLElement |
|
| 26 | + */ |
|
| 27 | 27 | private $subject; |
| 28 | 28 | |
| 29 | 29 | const DEF_DEPTH = 512; |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var array |
|
| 33 | - */ |
|
| 31 | + /** |
|
| 32 | + * @var array |
|
| 33 | + */ |
|
| 34 | 34 | private $options = array( |
| 35 | 35 | '@attributes' => true, |
| 36 | 36 | '@text' => true, |
| 37 | 37 | 'depth' => self::DEF_DEPTH |
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var array|string|null |
|
| 42 | - */ |
|
| 40 | + /** |
|
| 41 | + * @var array|string|null |
|
| 42 | + */ |
|
| 43 | 43 | protected $result = array(); |
| 44 | 44 | |
| 45 | 45 | public function __construct(\SimpleXMLElement $element) |
@@ -47,36 +47,36 @@ discard block |
||
| 47 | 47 | $this->subject = $element; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Whether to use the `@attributes` key to store element attributes. |
|
| 52 | - * |
|
| 53 | - * @param bool $bool |
|
| 54 | - * @return XMLHelper_Converter_Decorator |
|
| 55 | - */ |
|
| 50 | + /** |
|
| 51 | + * Whether to use the `@attributes` key to store element attributes. |
|
| 52 | + * |
|
| 53 | + * @param bool $bool |
|
| 54 | + * @return XMLHelper_Converter_Decorator |
|
| 55 | + */ |
|
| 56 | 56 | public function useAttributes(bool $bool) : XMLHelper_Converter_Decorator |
| 57 | 57 | { |
| 58 | 58 | $this->options['@attributes'] = (bool)$bool; |
| 59 | 59 | return $this; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Whether to use the `@text` key to store the node text. |
|
| 64 | - * |
|
| 65 | - * @param bool $bool |
|
| 66 | - * @return XMLHelper_Converter_Decorator |
|
| 67 | - */ |
|
| 62 | + /** |
|
| 63 | + * Whether to use the `@text` key to store the node text. |
|
| 64 | + * |
|
| 65 | + * @param bool $bool |
|
| 66 | + * @return XMLHelper_Converter_Decorator |
|
| 67 | + */ |
|
| 68 | 68 | public function useText(bool $bool) : XMLHelper_Converter_Decorator |
| 69 | 69 | { |
| 70 | 70 | $this->options['@text'] = (bool)$bool; |
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Set the maximum depth to parse in the document. |
|
| 76 | - * |
|
| 77 | - * @param int $depth |
|
| 78 | - * @return XMLHelper_Converter_Decorator |
|
| 79 | - */ |
|
| 74 | + /** |
|
| 75 | + * Set the maximum depth to parse in the document. |
|
| 76 | + * |
|
| 77 | + * @param int $depth |
|
| 78 | + * @return XMLHelper_Converter_Decorator |
|
| 79 | + */ |
|
| 80 | 80 | public function setDepth(int $depth) : XMLHelper_Converter_Decorator |
| 81 | 81 | { |
| 82 | 82 | $this->options['depth'] = (int)max(0, $depth); |
@@ -33,24 +33,24 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | const PATH_MODE_STRIP = 'strip'; |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @var string |
|
| 38 | - */ |
|
| 36 | + /** |
|
| 37 | + * @var string |
|
| 38 | + */ |
|
| 39 | 39 | protected $path; |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @var array |
|
| 43 | - */ |
|
| 41 | + /** |
|
| 42 | + * @var array |
|
| 43 | + */ |
|
| 44 | 44 | protected $found; |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * The path must exist when the class is instantiated: its |
|
| 48 | - * real path will be determined to work with. |
|
| 49 | - * |
|
| 50 | - * @param string $path The absolute path to the target folder. |
|
| 51 | - * @throws FileHelper_Exception |
|
| 52 | - * @see FileHelper_FileFinder::ERROR_PATH_DOES_NOT_EXIST |
|
| 53 | - */ |
|
| 46 | + /** |
|
| 47 | + * The path must exist when the class is instantiated: its |
|
| 48 | + * real path will be determined to work with. |
|
| 49 | + * |
|
| 50 | + * @param string $path The absolute path to the target folder. |
|
| 51 | + * @throws FileHelper_Exception |
|
| 52 | + * @see FileHelper_FileFinder::ERROR_PATH_DOES_NOT_EXIST |
|
| 53 | + */ |
|
| 54 | 54 | public function __construct(string $path) |
| 55 | 55 | { |
| 56 | 56 | $real = realpath($path); |
@@ -82,66 +82,66 @@ discard block |
||
| 82 | 82 | ); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * Enables extension stripping, to return file names without extension. |
|
| 87 | - * |
|
| 88 | - * @return FileHelper_FileFinder |
|
| 89 | - */ |
|
| 85 | + /** |
|
| 86 | + * Enables extension stripping, to return file names without extension. |
|
| 87 | + * |
|
| 88 | + * @return FileHelper_FileFinder |
|
| 89 | + */ |
|
| 90 | 90 | public function stripExtensions() : FileHelper_FileFinder |
| 91 | 91 | { |
| 92 | 92 | return $this->setOption('strip-extensions', true); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * Enables recursing into subfolders. |
|
| 97 | - * |
|
| 98 | - * @return FileHelper_FileFinder |
|
| 99 | - */ |
|
| 95 | + /** |
|
| 96 | + * Enables recursing into subfolders. |
|
| 97 | + * |
|
| 98 | + * @return FileHelper_FileFinder |
|
| 99 | + */ |
|
| 100 | 100 | public function makeRecursive() : FileHelper_FileFinder |
| 101 | 101 | { |
| 102 | 102 | return $this->setOption('recursive', true); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * Retrieves all extensions that were added to |
|
| 107 | - * the include list. |
|
| 108 | - * |
|
| 109 | - * @return array |
|
| 110 | - */ |
|
| 105 | + /** |
|
| 106 | + * Retrieves all extensions that were added to |
|
| 107 | + * the include list. |
|
| 108 | + * |
|
| 109 | + * @return array |
|
| 110 | + */ |
|
| 111 | 111 | public function getIncludeExtensions() : array |
| 112 | 112 | { |
| 113 | 113 | return $this->getArrayOption('include-extensions'); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * Includes a single extension in the file search: only |
|
| 118 | - * files with this extension will be used in the results. |
|
| 119 | - * |
|
| 120 | - * NOTE: Included extensions take precedence before excluded |
|
| 121 | - * extensions. If any excluded extensions are specified, they |
|
| 122 | - * will be ignored. |
|
| 123 | - * |
|
| 124 | - * @param string $extension Extension name, without dot (`php` for example). |
|
| 125 | - * @return FileHelper_FileFinder |
|
| 126 | - * @see FileHelper_FileFinder::includeExtensions() |
|
| 127 | - */ |
|
| 116 | + /** |
|
| 117 | + * Includes a single extension in the file search: only |
|
| 118 | + * files with this extension will be used in the results. |
|
| 119 | + * |
|
| 120 | + * NOTE: Included extensions take precedence before excluded |
|
| 121 | + * extensions. If any excluded extensions are specified, they |
|
| 122 | + * will be ignored. |
|
| 123 | + * |
|
| 124 | + * @param string $extension Extension name, without dot (`php` for example). |
|
| 125 | + * @return FileHelper_FileFinder |
|
| 126 | + * @see FileHelper_FileFinder::includeExtensions() |
|
| 127 | + */ |
|
| 128 | 128 | public function includeExtension(string $extension) : FileHelper_FileFinder |
| 129 | 129 | { |
| 130 | 130 | return $this->includeExtensions(array($extension)); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - /** |
|
| 134 | - * Includes several extensions in the file search: only |
|
| 135 | - * files with these extensions wil be used in the results. |
|
| 136 | - * |
|
| 137 | - * NOTE: Included extensions take precedence before excluded |
|
| 138 | - * extensions. If any excluded extensions are specified, they |
|
| 139 | - * will be ignored. |
|
| 140 | - * |
|
| 141 | - * @param array $extensions Extension names, without dot (`php` for example). |
|
| 142 | - * @return FileHelper_FileFinder |
|
| 143 | - * @see FileHelper_FileFinder::includeExtension() |
|
| 144 | - */ |
|
| 133 | + /** |
|
| 134 | + * Includes several extensions in the file search: only |
|
| 135 | + * files with these extensions wil be used in the results. |
|
| 136 | + * |
|
| 137 | + * NOTE: Included extensions take precedence before excluded |
|
| 138 | + * extensions. If any excluded extensions are specified, they |
|
| 139 | + * will be ignored. |
|
| 140 | + * |
|
| 141 | + * @param array $extensions Extension names, without dot (`php` for example). |
|
| 142 | + * @return FileHelper_FileFinder |
|
| 143 | + * @see FileHelper_FileFinder::includeExtension() |
|
| 144 | + */ |
|
| 145 | 145 | public function includeExtensions(array $extensions) : FileHelper_FileFinder |
| 146 | 146 | { |
| 147 | 147 | $items = $this->getIncludeExtensions(); |
@@ -152,37 +152,37 @@ discard block |
||
| 152 | 152 | return $this; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * Retrieves a list of all extensions currently set as |
|
| 157 | - * excluded from the search. |
|
| 158 | - * |
|
| 159 | - * @return array |
|
| 160 | - */ |
|
| 155 | + /** |
|
| 156 | + * Retrieves a list of all extensions currently set as |
|
| 157 | + * excluded from the search. |
|
| 158 | + * |
|
| 159 | + * @return array |
|
| 160 | + */ |
|
| 161 | 161 | public function getExcludeExtensions() : array |
| 162 | 162 | { |
| 163 | 163 | return $this->getArrayOption('exclude-extensions'); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - /** |
|
| 167 | - * Excludes a single extension from the search. |
|
| 168 | - * |
|
| 169 | - * @param string $extension Extension name, without dot (`php` for example). |
|
| 170 | - * @return FileHelper_FileFinder |
|
| 171 | - * @see FileHelper_FileFinder::excludeExtensions() |
|
| 172 | - */ |
|
| 166 | + /** |
|
| 167 | + * Excludes a single extension from the search. |
|
| 168 | + * |
|
| 169 | + * @param string $extension Extension name, without dot (`php` for example). |
|
| 170 | + * @return FileHelper_FileFinder |
|
| 171 | + * @see FileHelper_FileFinder::excludeExtensions() |
|
| 172 | + */ |
|
| 173 | 173 | public function excludeExtension(string $extension) : FileHelper_FileFinder |
| 174 | 174 | { |
| 175 | 175 | return $this->excludeExtensions(array($extension)); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - /** |
|
| 179 | - * Add several extensions to the list of extensions to |
|
| 180 | - * exclude from the file search. |
|
| 181 | - * |
|
| 182 | - * @param array $extensions Extension names, without dot (`php` for example). |
|
| 183 | - * @return FileHelper_FileFinder |
|
| 184 | - * @see FileHelper_FileFinder::excludeExtension() |
|
| 185 | - */ |
|
| 178 | + /** |
|
| 179 | + * Add several extensions to the list of extensions to |
|
| 180 | + * exclude from the file search. |
|
| 181 | + * |
|
| 182 | + * @param array $extensions Extension names, without dot (`php` for example). |
|
| 183 | + * @return FileHelper_FileFinder |
|
| 184 | + * @see FileHelper_FileFinder::excludeExtension() |
|
| 185 | + */ |
|
| 186 | 186 | public function excludeExtensions(array $extensions) : FileHelper_FileFinder |
| 187 | 187 | { |
| 188 | 188 | $items = $this->getExcludeExtensions(); |
@@ -193,52 +193,52 @@ discard block |
||
| 193 | 193 | return $this; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - /** |
|
| 197 | - * In this mode, the entire path to the file will be stripped, |
|
| 198 | - * leaving only the file name in the files list. |
|
| 199 | - * |
|
| 200 | - * @return FileHelper_FileFinder |
|
| 201 | - */ |
|
| 196 | + /** |
|
| 197 | + * In this mode, the entire path to the file will be stripped, |
|
| 198 | + * leaving only the file name in the files list. |
|
| 199 | + * |
|
| 200 | + * @return FileHelper_FileFinder |
|
| 201 | + */ |
|
| 202 | 202 | public function setPathmodeStrip() : FileHelper_FileFinder |
| 203 | 203 | { |
| 204 | 204 | return $this->setPathmode(self::PATH_MODE_STRIP); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - /** |
|
| 208 | - * In this mode, only the path relative to the source folder |
|
| 209 | - * will be included in the files list. |
|
| 210 | - * |
|
| 211 | - * @return FileHelper_FileFinder |
|
| 212 | - */ |
|
| 207 | + /** |
|
| 208 | + * In this mode, only the path relative to the source folder |
|
| 209 | + * will be included in the files list. |
|
| 210 | + * |
|
| 211 | + * @return FileHelper_FileFinder |
|
| 212 | + */ |
|
| 213 | 213 | public function setPathmodeRelative() : FileHelper_FileFinder |
| 214 | 214 | { |
| 215 | 215 | return $this->setPathmode(self::PATH_MODE_RELATIVE); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - /** |
|
| 219 | - * In this mode, the full, absolute paths to the files will |
|
| 220 | - * be included in the files list. |
|
| 221 | - * |
|
| 222 | - * @return FileHelper_FileFinder |
|
| 223 | - */ |
|
| 218 | + /** |
|
| 219 | + * In this mode, the full, absolute paths to the files will |
|
| 220 | + * be included in the files list. |
|
| 221 | + * |
|
| 222 | + * @return FileHelper_FileFinder |
|
| 223 | + */ |
|
| 224 | 224 | public function setPathmodeAbsolute() : FileHelper_FileFinder |
| 225 | 225 | { |
| 226 | 226 | return $this->setPathmode(self::PATH_MODE_ABSOLUTE); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - /** |
|
| 230 | - * This sets a character or string to replace the slashes |
|
| 231 | - * in the paths with. |
|
| 232 | - * |
|
| 233 | - * This is used for example in the `getPHPClassNames()` |
|
| 234 | - * method, to return files from subfolders as class names |
|
| 235 | - * using the "_" character: |
|
| 236 | - * |
|
| 237 | - * Subfolder/To/File.php => Subfolder_To_File.php |
|
| 238 | - * |
|
| 239 | - * @param string $character |
|
| 240 | - * @return \AppUtils\FileHelper_FileFinder |
|
| 241 | - */ |
|
| 229 | + /** |
|
| 230 | + * This sets a character or string to replace the slashes |
|
| 231 | + * in the paths with. |
|
| 232 | + * |
|
| 233 | + * This is used for example in the `getPHPClassNames()` |
|
| 234 | + * method, to return files from subfolders as class names |
|
| 235 | + * using the "_" character: |
|
| 236 | + * |
|
| 237 | + * Subfolder/To/File.php => Subfolder_To_File.php |
|
| 238 | + * |
|
| 239 | + * @param string $character |
|
| 240 | + * @return \AppUtils\FileHelper_FileFinder |
|
| 241 | + */ |
|
| 242 | 242 | public function setSlashReplacement(string $character) : FileHelper_FileFinder |
| 243 | 243 | { |
| 244 | 244 | return $this->setOption('slash-replacement', $character); |
@@ -249,12 +249,12 @@ discard block |
||
| 249 | 249 | return $this->setOption('pathmode', $mode); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * Retrieves a list of all matching file names/paths, |
|
| 254 | - * depending on the selected options. |
|
| 255 | - * |
|
| 256 | - * @return array |
|
| 257 | - */ |
|
| 252 | + /** |
|
| 253 | + * Retrieves a list of all matching file names/paths, |
|
| 254 | + * depending on the selected options. |
|
| 255 | + * |
|
| 256 | + * @return array |
|
| 257 | + */ |
|
| 258 | 258 | public function getAll() : array |
| 259 | 259 | { |
| 260 | 260 | $this->find($this->path, true); |
@@ -262,24 +262,24 @@ discard block |
||
| 262 | 262 | return $this->found; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - /** |
|
| 266 | - * Retrieves only PHP files. Can be combined with other |
|
| 267 | - * options like enabling recursion into subfolders. |
|
| 268 | - * |
|
| 269 | - * @return array |
|
| 270 | - */ |
|
| 265 | + /** |
|
| 266 | + * Retrieves only PHP files. Can be combined with other |
|
| 267 | + * options like enabling recursion into subfolders. |
|
| 268 | + * |
|
| 269 | + * @return array |
|
| 270 | + */ |
|
| 271 | 271 | public function getPHPFiles() : array |
| 272 | 272 | { |
| 273 | 273 | $this->includeExtensions(array('php')); |
| 274 | 274 | return $this->getAll(); |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - /** |
|
| 278 | - * Generates PHP class names from file paths: it replaces |
|
| 279 | - * slashes with underscores, and removes file extensions. |
|
| 280 | - * |
|
| 281 | - * @return array An array of PHP file names without extension. |
|
| 282 | - */ |
|
| 277 | + /** |
|
| 278 | + * Generates PHP class names from file paths: it replaces |
|
| 279 | + * slashes with underscores, and removes file extensions. |
|
| 280 | + * |
|
| 281 | + * @return array An array of PHP file names without extension. |
|
| 282 | + */ |
|
| 283 | 283 | public function getPHPClassNames() : array |
| 284 | 284 | { |
| 285 | 285 | $this->includeExtensions(array('php')); |
@@ -350,13 +350,13 @@ discard block |
||
| 350 | 350 | return $path; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - /** |
|
| 354 | - * Checks whether the specified extension is allowed |
|
| 355 | - * with the current settings. |
|
| 356 | - * |
|
| 357 | - * @param string $extension |
|
| 358 | - * @return bool |
|
| 359 | - */ |
|
| 353 | + /** |
|
| 354 | + * Checks whether the specified extension is allowed |
|
| 355 | + * with the current settings. |
|
| 356 | + * |
|
| 357 | + * @param string $extension |
|
| 358 | + * @return bool |
|
| 359 | + */ |
|
| 360 | 360 | protected function filterExclusion(string $extension) : bool |
| 361 | 361 | { |
| 362 | 362 | $include = $this->getOption('include-extensions'); |
@@ -378,12 +378,12 @@ discard block |
||
| 378 | 378 | return true; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - /** |
|
| 382 | - * Adjusts the path according to the selected path mode. |
|
| 383 | - * |
|
| 384 | - * @param string $path |
|
| 385 | - * @return string |
|
| 386 | - */ |
|
| 381 | + /** |
|
| 382 | + * Adjusts the path according to the selected path mode. |
|
| 383 | + * |
|
| 384 | + * @param string $path |
|
| 385 | + * @return string |
|
| 386 | + */ |
|
| 387 | 387 | protected function filterPath(string $path) : string |
| 388 | 388 | { |
| 389 | 389 | switch($this->getStringOption('pathmode')) |
@@ -23,44 +23,44 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class Request_URLComparer |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * @var Request |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var Request |
|
| 28 | + */ |
|
| 29 | 29 | protected $request; |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var string |
|
| 33 | - */ |
|
| 31 | + /** |
|
| 32 | + * @var string |
|
| 33 | + */ |
|
| 34 | 34 | protected $sourceURL; |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @var string |
|
| 38 | - */ |
|
| 36 | + /** |
|
| 37 | + * @var string |
|
| 38 | + */ |
|
| 39 | 39 | protected $targetURL; |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @var array |
|
| 43 | - */ |
|
| 41 | + /** |
|
| 42 | + * @var array |
|
| 43 | + */ |
|
| 44 | 44 | protected $limitParams = array(); |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * @var bool |
|
| 48 | - */ |
|
| 46 | + /** |
|
| 47 | + * @var bool |
|
| 48 | + */ |
|
| 49 | 49 | protected $isMatch = false; |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @var bool |
|
| 53 | - */ |
|
| 51 | + /** |
|
| 52 | + * @var bool |
|
| 53 | + */ |
|
| 54 | 54 | protected $ignoreFragment = true; |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @var URLInfo |
|
| 58 | - */ |
|
| 56 | + /** |
|
| 57 | + * @var URLInfo |
|
| 58 | + */ |
|
| 59 | 59 | protected $sourceInfo; |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @var URLInfo |
|
| 63 | - */ |
|
| 61 | + /** |
|
| 62 | + * @var URLInfo |
|
| 63 | + */ |
|
| 64 | 64 | protected $targetInfo; |
| 65 | 65 | |
| 66 | 66 | public function __construct(Request $request, string $sourceURL, string $targetURL) |