@@ -32,23 +32,23 @@ |
||
| 32 | 32 | $this->info = $info; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Enables the authentication information in the URL, |
|
| 37 | - * if a username and password are present. |
|
| 38 | - * |
|
| 39 | - * @param bool $enable Whether to turn it on or off. |
|
| 40 | - * @return URLInfo_Normalizer |
|
| 41 | - */ |
|
| 35 | + /** |
|
| 36 | + * Enables the authentication information in the URL, |
|
| 37 | + * if a username and password are present. |
|
| 38 | + * |
|
| 39 | + * @param bool $enable Whether to turn it on or off. |
|
| 40 | + * @return URLInfo_Normalizer |
|
| 41 | + */ |
|
| 42 | 42 | public function enableAuth(bool $enable=true) : URLInfo_Normalizer |
| 43 | 43 | { |
| 44 | 44 | $this->auth = $enable; |
| 45 | 45 | return $this; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Retrieves the normalized URL. |
|
| 50 | - * @return string |
|
| 51 | - */ |
|
| 48 | + /** |
|
| 49 | + * Retrieves the normalized URL. |
|
| 50 | + * @return string |
|
| 51 | + */ |
|
| 52 | 52 | public function normalize() : string |
| 53 | 53 | { |
| 54 | 54 | $method = 'normalize_'.$this->info->getType(); |
@@ -27,14 +27,14 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | protected $param; |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @var mixed |
|
| 32 | - */ |
|
| 30 | + /** |
|
| 31 | + * @var mixed |
|
| 32 | + */ |
|
| 33 | 33 | protected $value; |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var bool |
|
| 37 | - */ |
|
| 35 | + /** |
|
| 36 | + * @var bool |
|
| 37 | + */ |
|
| 38 | 38 | protected $isSubvalue = false; |
| 39 | 39 | |
| 40 | 40 | public function __construct(Request_Param $param, bool $subval) |
@@ -114,18 +114,18 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * Adds a callback as a validation method. The callback gets the |
|
| 119 | - * value to validate as first parameter, and any additional |
|
| 120 | - * parameters passed here get appended to that. |
|
| 121 | - * |
|
| 122 | - * The callback must return boolean true or false depending on |
|
| 123 | - * whether the value is valid. |
|
| 124 | - * |
|
| 125 | - * @param callable $callback |
|
| 126 | - * @param array $args |
|
| 127 | - * @return Request_Param |
|
| 128 | - */ |
|
| 117 | + /** |
|
| 118 | + * Adds a callback as a validation method. The callback gets the |
|
| 119 | + * value to validate as first parameter, and any additional |
|
| 120 | + * parameters passed here get appended to that. |
|
| 121 | + * |
|
| 122 | + * The callback must return boolean true or false depending on |
|
| 123 | + * whether the value is valid. |
|
| 124 | + * |
|
| 125 | + * @param callable $callback |
|
| 126 | + * @param array $args |
|
| 127 | + * @return Request_Param |
|
| 128 | + */ |
|
| 129 | 129 | public function setCallback($callback, array $args=array()) : Request_Param |
| 130 | 130 | { |
| 131 | 131 | if(!is_callable($callback)) { |
@@ -189,12 +189,12 @@ discard block |
||
| 189 | 189 | return $value; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - /** |
|
| 193 | - * Runs the value through all validations that were added. |
|
| 194 | - * |
|
| 195 | - * @param mixed $value |
|
| 196 | - * @return mixed |
|
| 197 | - */ |
|
| 192 | + /** |
|
| 193 | + * Runs the value through all validations that were added. |
|
| 194 | + * |
|
| 195 | + * @param mixed $value |
|
| 196 | + * @return mixed |
|
| 197 | + */ |
|
| 198 | 198 | protected function applyValidations($value, bool $subval=false) |
| 199 | 199 | { |
| 200 | 200 | // go through all enqueued validations in turn, each time |
@@ -207,17 +207,17 @@ discard block |
||
| 207 | 207 | return $value; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - /** |
|
| 211 | - * Validates the specified value using the validation type. Returns |
|
| 212 | - * the validated value. |
|
| 213 | - * |
|
| 214 | - * @param mixed $value |
|
| 215 | - * @param string $type |
|
| 216 | - * @param array $params |
|
| 217 | - * @param bool $subval Whether this is a subvalue in a list |
|
| 218 | - * @throws Request_Exception |
|
| 219 | - * @return mixed |
|
| 220 | - */ |
|
| 210 | + /** |
|
| 211 | + * Validates the specified value using the validation type. Returns |
|
| 212 | + * the validated value. |
|
| 213 | + * |
|
| 214 | + * @param mixed $value |
|
| 215 | + * @param string $type |
|
| 216 | + * @param array $params |
|
| 217 | + * @param bool $subval Whether this is a subvalue in a list |
|
| 218 | + * @throws Request_Exception |
|
| 219 | + * @return mixed |
|
| 220 | + */ |
|
| 221 | 221 | protected function validateType($value, string $type, array $params, bool $subval) |
| 222 | 222 | { |
| 223 | 223 | $class = '\AppUtils\Request_Param_Validator_'.ucfirst($type); |
@@ -286,13 +286,13 @@ discard block |
||
| 286 | 286 | |
| 287 | 287 | protected $valueType = self::VALUE_TYPE_STRING; |
| 288 | 288 | |
| 289 | - /** |
|
| 290 | - * Sets the variable to contain a comma-separated list of integer IDs. |
|
| 291 | - * Example: <code>145,248,4556</code>. A single ID is also allowed, e.g. |
|
| 292 | - * <code>145</code>. |
|
| 293 | - * |
|
| 294 | - * @return Request_Param |
|
| 295 | - */ |
|
| 289 | + /** |
|
| 290 | + * Sets the variable to contain a comma-separated list of integer IDs. |
|
| 291 | + * Example: <code>145,248,4556</code>. A single ID is also allowed, e.g. |
|
| 292 | + * <code>145</code>. |
|
| 293 | + * |
|
| 294 | + * @return Request_Param |
|
| 295 | + */ |
|
| 296 | 296 | public function setIDList() |
| 297 | 297 | { |
| 298 | 298 | $this->valueType = self::VALUE_TYPE_LIST; |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | return $this; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - /** |
|
| 306 | - * Sets the variable to be an alias, as defined by the |
|
| 307 | - * {@link RegexHelper::REGEX_ALIAS} regular expression. |
|
| 308 | - * |
|
| 309 | - * @return Request_Param |
|
| 310 | - * @see RegexHelper::REGEX_ALIAS |
|
| 311 | - */ |
|
| 305 | + /** |
|
| 306 | + * Sets the variable to be an alias, as defined by the |
|
| 307 | + * {@link RegexHelper::REGEX_ALIAS} regular expression. |
|
| 308 | + * |
|
| 309 | + * @return Request_Param |
|
| 310 | + * @see RegexHelper::REGEX_ALIAS |
|
| 311 | + */ |
|
| 312 | 312 | public function setAlias() |
| 313 | 313 | { |
| 314 | 314 | return $this->setRegex(RegexHelper::REGEX_ALIAS); |
@@ -349,12 +349,12 @@ discard block |
||
| 349 | 349 | return $this->setValidation(self::VALIDATION_TYPE_ALPHA); |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - /** |
|
| 353 | - * Sets the parameter value as a string containing lowercase |
|
| 354 | - * and/or uppercase letters, as well as numbers. |
|
| 355 | - * |
|
| 356 | - * @return Request_Param |
|
| 357 | - */ |
|
| 352 | + /** |
|
| 353 | + * Sets the parameter value as a string containing lowercase |
|
| 354 | + * and/or uppercase letters, as well as numbers. |
|
| 355 | + * |
|
| 356 | + * @return Request_Param |
|
| 357 | + */ |
|
| 358 | 358 | public function setAlnum() |
| 359 | 359 | { |
| 360 | 360 | return $this->setValidation(self::VALIDATION_TYPE_ALNUM); |
@@ -387,17 +387,17 @@ discard block |
||
| 387 | 387 | ); |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - /** |
|
| 391 | - * Only available for array values: the parameter must be |
|
| 392 | - * an array value, and the array may only contain values |
|
| 393 | - * specified in the values array. |
|
| 394 | - * |
|
| 395 | - * Submitted values that are not in the allowed list of |
|
| 396 | - * values are stripped from the value. |
|
| 397 | - * |
|
| 398 | - * @param array $values List of allowed values |
|
| 399 | - * @return \AppUtils\Request_Param |
|
| 400 | - */ |
|
| 390 | + /** |
|
| 391 | + * Only available for array values: the parameter must be |
|
| 392 | + * an array value, and the array may only contain values |
|
| 393 | + * specified in the values array. |
|
| 394 | + * |
|
| 395 | + * Submitted values that are not in the allowed list of |
|
| 396 | + * values are stripped from the value. |
|
| 397 | + * |
|
| 398 | + * @param array $values List of allowed values |
|
| 399 | + * @return \AppUtils\Request_Param |
|
| 400 | + */ |
|
| 401 | 401 | public function setValuesList(array $values) |
| 402 | 402 | { |
| 403 | 403 | $this->setArray(); |
@@ -410,11 +410,11 @@ discard block |
||
| 410 | 410 | ); |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - /** |
|
| 414 | - * Whether the parameter is a list of values. |
|
| 415 | - * |
|
| 416 | - * @return bool |
|
| 417 | - */ |
|
| 413 | + /** |
|
| 414 | + * Whether the parameter is a list of values. |
|
| 415 | + * |
|
| 416 | + * @return bool |
|
| 417 | + */ |
|
| 418 | 418 | public function isList() : bool |
| 419 | 419 | { |
| 420 | 420 | return $this->valueType === self::VALUE_TYPE_LIST; |
@@ -425,53 +425,53 @@ discard block |
||
| 425 | 425 | return $this->setValidation(self::VALIDATION_TYPE_ARRAY); |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - /** |
|
| 429 | - * Specifies that a JSON-encoded string is expected. |
|
| 430 | - * |
|
| 431 | - * NOTE: Numbers or quoted strings are technically valid |
|
| 432 | - * JSON, but are not accepted, because it is assumed |
|
| 433 | - * at least an array or object are expected. |
|
| 434 | - * |
|
| 435 | - * @return \AppUtils\Request_Param |
|
| 436 | - */ |
|
| 428 | + /** |
|
| 429 | + * Specifies that a JSON-encoded string is expected. |
|
| 430 | + * |
|
| 431 | + * NOTE: Numbers or quoted strings are technically valid |
|
| 432 | + * JSON, but are not accepted, because it is assumed |
|
| 433 | + * at least an array or object are expected. |
|
| 434 | + * |
|
| 435 | + * @return \AppUtils\Request_Param |
|
| 436 | + */ |
|
| 437 | 437 | public function setJSON() : Request_Param |
| 438 | 438 | { |
| 439 | 439 | return $this->setValidation(self::VALIDATION_TYPE_JSON, array('arrays' => true)); |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - /** |
|
| 443 | - * Like {@link Request_Param::setJSON()}, but accepts |
|
| 444 | - * only JSON objects. Arrays will not be accepted. |
|
| 445 | - * |
|
| 446 | - * @return \AppUtils\Request_Param |
|
| 447 | - */ |
|
| 442 | + /** |
|
| 443 | + * Like {@link Request_Param::setJSON()}, but accepts |
|
| 444 | + * only JSON objects. Arrays will not be accepted. |
|
| 445 | + * |
|
| 446 | + * @return \AppUtils\Request_Param |
|
| 447 | + */ |
|
| 448 | 448 | public function setJSONObject() : Request_Param |
| 449 | 449 | { |
| 450 | 450 | return $this->setValidation(self::VALIDATION_TYPE_JSON, array('arrays' => false)); |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | - /** |
|
| 454 | - * The parameter is a string boolean representation. This means |
|
| 455 | - * it can be any of the following: "yes", "true", "no", "false". |
|
| 456 | - * The value is automatically converted to a boolean when retrieving |
|
| 457 | - * the parameter. |
|
| 458 | - * |
|
| 459 | - * @return Request_Param |
|
| 460 | - */ |
|
| 453 | + /** |
|
| 454 | + * The parameter is a string boolean representation. This means |
|
| 455 | + * it can be any of the following: "yes", "true", "no", "false". |
|
| 456 | + * The value is automatically converted to a boolean when retrieving |
|
| 457 | + * the parameter. |
|
| 458 | + * |
|
| 459 | + * @return Request_Param |
|
| 460 | + */ |
|
| 461 | 461 | public function setBoolean() : Request_Param |
| 462 | 462 | { |
| 463 | 463 | return $this->addClassFilter('Boolean'); |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | - /** |
|
| 467 | - * Validates the request parameter as an MD5 string, |
|
| 468 | - * so that only values resembling md5 values are accepted. |
|
| 469 | - * |
|
| 470 | - * NOTE: This can only guarantee the format, not whether |
|
| 471 | - * it is an actual valid hash of something. |
|
| 472 | - * |
|
| 473 | - * @return \AppUtils\Request_Param |
|
| 474 | - */ |
|
| 466 | + /** |
|
| 467 | + * Validates the request parameter as an MD5 string, |
|
| 468 | + * so that only values resembling md5 values are accepted. |
|
| 469 | + * |
|
| 470 | + * NOTE: This can only guarantee the format, not whether |
|
| 471 | + * it is an actual valid hash of something. |
|
| 472 | + * |
|
| 473 | + * @return \AppUtils\Request_Param |
|
| 474 | + */ |
|
| 475 | 475 | public function setMD5() : Request_Param |
| 476 | 476 | { |
| 477 | 477 | return $this->setRegex(RegexHelper::REGEX_MD5); |
@@ -513,14 +513,14 @@ discard block |
||
| 513 | 513 | return $this; |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - /** |
|
| 517 | - * Retrieves the value of the request parameter, |
|
| 518 | - * applying all filters (if any) and validation |
|
| 519 | - * (if any). |
|
| 520 | - * |
|
| 521 | - * @param mixed $default |
|
| 522 | - * @return mixed |
|
| 523 | - */ |
|
| 516 | + /** |
|
| 517 | + * Retrieves the value of the request parameter, |
|
| 518 | + * applying all filters (if any) and validation |
|
| 519 | + * (if any). |
|
| 520 | + * |
|
| 521 | + * @param mixed $default |
|
| 522 | + * @return mixed |
|
| 523 | + */ |
|
| 524 | 524 | public function get($default=null) |
| 525 | 525 | { |
| 526 | 526 | $value = $this->request->getParam($this->paramName); |
@@ -531,14 +531,14 @@ discard block |
||
| 531 | 531 | return $this->validate($default); |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - /** |
|
| 535 | - * Filters the specified value by going through all available |
|
| 536 | - * filters, if any. If none have been set, the value is simply |
|
| 537 | - * passed through. |
|
| 538 | - * |
|
| 539 | - * @param mixed $value |
|
| 540 | - * @return mixed |
|
| 541 | - */ |
|
| 534 | + /** |
|
| 535 | + * Filters the specified value by going through all available |
|
| 536 | + * filters, if any. If none have been set, the value is simply |
|
| 537 | + * passed through. |
|
| 538 | + * |
|
| 539 | + * @param mixed $value |
|
| 540 | + * @return mixed |
|
| 541 | + */ |
|
| 542 | 542 | protected function filter($value) |
| 543 | 543 | { |
| 544 | 544 | $total = count($this->filters); |
@@ -608,12 +608,12 @@ discard block |
||
| 608 | 608 | return $this; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - /** |
|
| 612 | - * Adds a filter that trims whitespace from the request |
|
| 613 | - * parameter using the PHP <code>trim</code> function. |
|
| 614 | - * |
|
| 615 | - * @return \AppUtils\Request_Param |
|
| 616 | - */ |
|
| 611 | + /** |
|
| 612 | + * Adds a filter that trims whitespace from the request |
|
| 613 | + * parameter using the PHP <code>trim</code> function. |
|
| 614 | + * |
|
| 615 | + * @return \AppUtils\Request_Param |
|
| 616 | + */ |
|
| 617 | 617 | public function addFilterTrim() : Request_Param |
| 618 | 618 | { |
| 619 | 619 | // to guarantee we only work with strings |
@@ -622,13 +622,13 @@ discard block |
||
| 622 | 622 | return $this->addCallbackFilter('trim'); |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | - /** |
|
| 626 | - * Converts the value to a string, even if it is not |
|
| 627 | - * a string value. Complex types like arrays and objects |
|
| 628 | - * are converted to an empty string. |
|
| 629 | - * |
|
| 630 | - * @return \AppUtils\Request_Param |
|
| 631 | - */ |
|
| 625 | + /** |
|
| 626 | + * Converts the value to a string, even if it is not |
|
| 627 | + * a string value. Complex types like arrays and objects |
|
| 628 | + * are converted to an empty string. |
|
| 629 | + * |
|
| 630 | + * @return \AppUtils\Request_Param |
|
| 631 | + */ |
|
| 632 | 632 | public function addStringFilter() : Request_Param |
| 633 | 633 | { |
| 634 | 634 | return $this->addClassFilter('String'); |
@@ -678,12 +678,12 @@ discard block |
||
| 678 | 678 | return $this->addCallbackFilter('strip_tags', array($allowedTags)); |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | - /** |
|
| 682 | - * Adds a filter that strips all whitespace from the |
|
| 683 | - * request parameter, from spaces to tabs and newlines. |
|
| 684 | - * |
|
| 685 | - * @return \AppUtils\Request_Param |
|
| 686 | - */ |
|
| 681 | + /** |
|
| 682 | + * Adds a filter that strips all whitespace from the |
|
| 683 | + * request parameter, from spaces to tabs and newlines. |
|
| 684 | + * |
|
| 685 | + * @return \AppUtils\Request_Param |
|
| 686 | + */ |
|
| 687 | 687 | public function addStripWhitespaceFilter() : Request_Param |
| 688 | 688 | { |
| 689 | 689 | // to ensure we only work with strings. |
@@ -692,14 +692,14 @@ discard block |
||
| 692 | 692 | return $this->addClassFilter('StripWhitespace'); |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | - /** |
|
| 696 | - * Adds a filter that transforms comma separated values |
|
| 697 | - * into an array of values. |
|
| 698 | - * |
|
| 699 | - * @param bool $trimEntries Trim whitespace from each entry? |
|
| 700 | - * @param bool $stripEmptyEntries Remove empty entries from the array? |
|
| 701 | - * @return \AppUtils\Request_Param |
|
| 702 | - */ |
|
| 695 | + /** |
|
| 696 | + * Adds a filter that transforms comma separated values |
|
| 697 | + * into an array of values. |
|
| 698 | + * |
|
| 699 | + * @param bool $trimEntries Trim whitespace from each entry? |
|
| 700 | + * @param bool $stripEmptyEntries Remove empty entries from the array? |
|
| 701 | + * @return \AppUtils\Request_Param |
|
| 702 | + */ |
|
| 703 | 703 | public function addCommaSeparatedFilter(bool $trimEntries=true, bool $stripEmptyEntries=true) : Request_Param |
| 704 | 704 | { |
| 705 | 705 | $this->setArray(); |
@@ -724,12 +724,12 @@ discard block |
||
| 724 | 724 | ); |
| 725 | 725 | } |
| 726 | 726 | |
| 727 | - /** |
|
| 728 | - * Adds a filter that encodes all HTML special characters |
|
| 729 | - * using the PHP <code>htmlspecialchars</code> function. |
|
| 730 | - * |
|
| 731 | - * @return \AppUtils\Request_Param |
|
| 732 | - */ |
|
| 727 | + /** |
|
| 728 | + * Adds a filter that encodes all HTML special characters |
|
| 729 | + * using the PHP <code>htmlspecialchars</code> function. |
|
| 730 | + * |
|
| 731 | + * @return \AppUtils\Request_Param |
|
| 732 | + */ |
|
| 733 | 733 | public function addHTMLSpecialcharsFilter() : Request_Param |
| 734 | 734 | { |
| 735 | 735 | return $this->addCallbackFilter('htmlspecialchars', array(ENT_QUOTES, 'UTF-8')); |
@@ -742,14 +742,14 @@ discard block |
||
| 742 | 742 | |
| 743 | 743 | protected $required = false; |
| 744 | 744 | |
| 745 | - /** |
|
| 746 | - * Marks this request parameter as required. To use this feature, |
|
| 747 | - * you have to call the request's {@link Request::validate()} |
|
| 748 | - * method. |
|
| 749 | - * |
|
| 750 | - * @return Request_Param |
|
| 751 | - * @see Request::validate() |
|
| 752 | - */ |
|
| 745 | + /** |
|
| 746 | + * Marks this request parameter as required. To use this feature, |
|
| 747 | + * you have to call the request's {@link Request::validate()} |
|
| 748 | + * method. |
|
| 749 | + * |
|
| 750 | + * @return Request_Param |
|
| 751 | + * @see Request::validate() |
|
| 752 | + */ |
|
| 753 | 753 | public function makeRequired() : Request_Param |
| 754 | 754 | { |
| 755 | 755 | $this->required = true; |
@@ -19,34 +19,34 @@ discard block |
||
| 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 | - /** |
|
| 48 | - * @var string |
|
| 49 | - */ |
|
| 47 | + /** |
|
| 48 | + * @var string |
|
| 49 | + */ |
|
| 50 | 50 | protected $transferEncoding = ''; |
| 51 | 51 | |
| 52 | 52 | public function __construct(RequestHelper_Boundaries $boundaries, string $content) |
@@ -60,46 +60,46 @@ discard block |
||
| 60 | 60 | return strlen($this->content); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Sets the name of the request parameter. |
|
| 65 | - * |
|
| 66 | - * @param string $name |
|
| 67 | - * @return RequestHelper_Boundaries_Boundary |
|
| 68 | - */ |
|
| 63 | + /** |
|
| 64 | + * Sets the name of the request parameter. |
|
| 65 | + * |
|
| 66 | + * @param string $name |
|
| 67 | + * @return RequestHelper_Boundaries_Boundary |
|
| 68 | + */ |
|
| 69 | 69 | public function setName(string $name) : RequestHelper_Boundaries_Boundary |
| 70 | 70 | { |
| 71 | 71 | return $this->setDispositionParam('name', $name); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Sets the filename to use for the content, if applicable. |
|
| 76 | - * |
|
| 77 | - * @param string $fileName |
|
| 78 | - * @return RequestHelper_Boundaries_Boundary |
|
| 79 | - */ |
|
| 74 | + /** |
|
| 75 | + * Sets the filename to use for the content, if applicable. |
|
| 76 | + * |
|
| 77 | + * @param string $fileName |
|
| 78 | + * @return RequestHelper_Boundaries_Boundary |
|
| 79 | + */ |
|
| 80 | 80 | public function setFileName(string $fileName) : RequestHelper_Boundaries_Boundary |
| 81 | 81 | { |
| 82 | 82 | return $this->setDispositionParam('filename', $fileName); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * Sets the content type to use for the content. |
|
| 87 | - * |
|
| 88 | - * @param string $contentType |
|
| 89 | - * @return RequestHelper_Boundaries_Boundary |
|
| 90 | - */ |
|
| 85 | + /** |
|
| 86 | + * Sets the content type to use for the content. |
|
| 87 | + * |
|
| 88 | + * @param string $contentType |
|
| 89 | + * @return RequestHelper_Boundaries_Boundary |
|
| 90 | + */ |
|
| 91 | 91 | public function setContentType(string $contentType) : RequestHelper_Boundaries_Boundary |
| 92 | 92 | { |
| 93 | 93 | $this->contentType = $contentType; |
| 94 | 94 | return $this; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Sets the encoding to specify for the content. |
|
| 99 | - * |
|
| 100 | - * @param string $encoding An encoding string, e.g. "UTF-8", "ASCII" |
|
| 101 | - * @return RequestHelper_Boundaries_Boundary |
|
| 102 | - */ |
|
| 97 | + /** |
|
| 98 | + * Sets the encoding to specify for the content. |
|
| 99 | + * |
|
| 100 | + * @param string $encoding An encoding string, e.g. "UTF-8", "ASCII" |
|
| 101 | + * @return RequestHelper_Boundaries_Boundary |
|
| 102 | + */ |
|
| 103 | 103 | public function setContentEncoding(string $encoding) : RequestHelper_Boundaries_Boundary |
| 104 | 104 | { |
| 105 | 105 | $this->contentEncoding = $encoding; |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | return $this; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * Renders the mime boundary text. |
|
| 124 | - * |
|
| 125 | - * @return string |
|
| 126 | - */ |
|
| 122 | + /** |
|
| 123 | + * Renders the mime boundary text. |
|
| 124 | + * |
|
| 125 | + * @return string |
|
| 126 | + */ |
|
| 127 | 127 | public function render() |
| 128 | 128 | { |
| 129 | 129 | $eol = $this->boundaries->getEOL(); |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | class URLInfo_Highlighter |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var URLInfo |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * @var URLInfo |
|
| 25 | + */ |
|
| 26 | 26 | protected $info; |
| 27 | 27 | |
| 28 | 28 | public function __construct(URLInfo $info) |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | ); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - /** |
|
| 162 | - * Fetches all parameters in the URL, regardless of |
|
| 163 | - * whether parameter exclusion is enabled, so they |
|
| 164 | - * can be highlighted is need be. |
|
| 165 | - * |
|
| 166 | - * @return array |
|
| 167 | - */ |
|
| 161 | + /** |
|
| 162 | + * Fetches all parameters in the URL, regardless of |
|
| 163 | + * whether parameter exclusion is enabled, so they |
|
| 164 | + * can be highlighted is need be. |
|
| 165 | + * |
|
| 166 | + * @return array |
|
| 167 | + */ |
|
| 168 | 168 | protected function resolveParams() : array |
| 169 | 169 | { |
| 170 | 170 | $previous = $this->info->isParamExclusionEnabled(); |
@@ -14,9 +14,9 @@ |
||
| 14 | 14 | * @see http://www.xmlsoft.org/html/libxml-xmlerror.html |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * @var string $list |
|
| 19 | - */ |
|
| 17 | + /** |
|
| 18 | + * @var string $list |
|
| 19 | + */ |
|
| 20 | 20 | $list = file_get_contents('libxmlerrors.txt'); |
| 21 | 21 | $outputFile = 'LibXML.php'; |
| 22 | 22 | $lines = explode("\n", $list); |
@@ -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 | |
@@ -126,30 +126,30 @@ discard block |
||
| 126 | 126 | return $this->buildURL($params, $dispatcher); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - /** |
|
| 130 | - * Retrieves the name of the current dispatcher script / page. |
|
| 131 | - * This is made to be extended and implemented in a subclass. |
|
| 132 | - * |
|
| 133 | - * @return string |
|
| 134 | - */ |
|
| 129 | + /** |
|
| 130 | + * Retrieves the name of the current dispatcher script / page. |
|
| 131 | + * This is made to be extended and implemented in a subclass. |
|
| 132 | + * |
|
| 133 | + * @return string |
|
| 134 | + */ |
|
| 135 | 135 | public function getDispatcher() : string |
| 136 | 136 | { |
| 137 | 137 | return ''; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - /** |
|
| 141 | - * Filters and retrieves the current request variables |
|
| 142 | - * to be used to build an URL to refresh the current page. |
|
| 143 | - * |
|
| 144 | - * For further customization options, use the |
|
| 145 | - * {@see Request::createRefreshParams()} method. |
|
| 146 | - * |
|
| 147 | - * @param array<string,mixed> $params Key => value pairs of parameters to always include in the result. |
|
| 148 | - * @param string[] $exclude Names of parameters to exclude from the result. |
|
| 149 | - * @return array<string,mixed> |
|
| 150 | - * |
|
| 151 | - * @see Request::createRefreshParams() |
|
| 152 | - */ |
|
| 140 | + /** |
|
| 141 | + * Filters and retrieves the current request variables |
|
| 142 | + * to be used to build an URL to refresh the current page. |
|
| 143 | + * |
|
| 144 | + * For further customization options, use the |
|
| 145 | + * {@see Request::createRefreshParams()} method. |
|
| 146 | + * |
|
| 147 | + * @param array<string,mixed> $params Key => value pairs of parameters to always include in the result. |
|
| 148 | + * @param string[] $exclude Names of parameters to exclude from the result. |
|
| 149 | + * @return array<string,mixed> |
|
| 150 | + * |
|
| 151 | + * @see Request::createRefreshParams() |
|
| 152 | + */ |
|
| 153 | 153 | public function getRefreshParams(array $params = array(), array $exclude = array()) |
| 154 | 154 | { |
| 155 | 155 | return $this->createRefreshParams() |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | ->getParams(); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - /** |
|
| 162 | - * Creates an instance of the helper that can be used to |
|
| 163 | - * retrieve the request's parameters collection, with the |
|
| 164 | - * possiblity to exlude and override some by rules. |
|
| 165 | - * |
|
| 166 | - * @return Request_RefreshParams |
|
| 167 | - */ |
|
| 161 | + /** |
|
| 162 | + * Creates an instance of the helper that can be used to |
|
| 163 | + * retrieve the request's parameters collection, with the |
|
| 164 | + * possiblity to exlude and override some by rules. |
|
| 165 | + * |
|
| 166 | + * @return Request_RefreshParams |
|
| 167 | + */ |
|
| 168 | 168 | public function createRefreshParams() : Request_RefreshParams |
| 169 | 169 | { |
| 170 | 170 | return new Request_RefreshParams(); |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | return $url; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - /** |
|
| 201 | - * Retrieves the base URL of the application. |
|
| 202 | - * @return string |
|
| 203 | - */ |
|
| 200 | + /** |
|
| 201 | + * Retrieves the base URL of the application. |
|
| 202 | + * @return string |
|
| 203 | + */ |
|
| 204 | 204 | public function getBaseURL() : string |
| 205 | 205 | { |
| 206 | 206 | return $this->baseURL; |
@@ -230,13 +230,13 @@ discard block |
||
| 230 | 230 | return $this->knownParams[$name]; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - /** |
|
| 234 | - * Retrieves a previously registered parameter instance. |
|
| 235 | - * |
|
| 236 | - * @param string $name |
|
| 237 | - * @throws Request_Exception |
|
| 238 | - * @return Request_Param |
|
| 239 | - */ |
|
| 233 | + /** |
|
| 234 | + * Retrieves a previously registered parameter instance. |
|
| 235 | + * |
|
| 236 | + * @param string $name |
|
| 237 | + * @throws Request_Exception |
|
| 238 | + * @return Request_Param |
|
| 239 | + */ |
|
| 240 | 240 | public function getRegisteredParam(string $name) : Request_Param |
| 241 | 241 | { |
| 242 | 242 | if(isset($this->knownParams[$name])) { |
@@ -253,48 +253,48 @@ discard block |
||
| 253 | 253 | ); |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - /** |
|
| 257 | - * Checks whether a parameter with the specified name |
|
| 258 | - * has been registered. |
|
| 259 | - * |
|
| 260 | - * @param string $name |
|
| 261 | - * @return bool |
|
| 262 | - */ |
|
| 256 | + /** |
|
| 257 | + * Checks whether a parameter with the specified name |
|
| 258 | + * has been registered. |
|
| 259 | + * |
|
| 260 | + * @param string $name |
|
| 261 | + * @return bool |
|
| 262 | + */ |
|
| 263 | 263 | public function hasRegisteredParam(string $name) : bool |
| 264 | 264 | { |
| 265 | 265 | return isset($this->knownParams[$name]); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - /** |
|
| 269 | - * Retrieves an indexed array with accept mime types |
|
| 270 | - * that the client sent, in the order of preference |
|
| 271 | - * the client specified. |
|
| 272 | - * |
|
| 273 | - * Example: |
|
| 274 | - * |
|
| 275 | - * array( |
|
| 276 | - * 'text/html', |
|
| 277 | - * 'application/xhtml+xml', |
|
| 278 | - * 'image/webp' |
|
| 279 | - * ... |
|
| 280 | - * ) |
|
| 281 | - * |
|
| 282 | - * @return array |
|
| 283 | - * @see Request::parseAcceptHeaders() |
|
| 284 | - */ |
|
| 268 | + /** |
|
| 269 | + * Retrieves an indexed array with accept mime types |
|
| 270 | + * that the client sent, in the order of preference |
|
| 271 | + * the client specified. |
|
| 272 | + * |
|
| 273 | + * Example: |
|
| 274 | + * |
|
| 275 | + * array( |
|
| 276 | + * 'text/html', |
|
| 277 | + * 'application/xhtml+xml', |
|
| 278 | + * 'image/webp' |
|
| 279 | + * ... |
|
| 280 | + * ) |
|
| 281 | + * |
|
| 282 | + * @return array |
|
| 283 | + * @see Request::parseAcceptHeaders() |
|
| 284 | + */ |
|
| 285 | 285 | public static function getAcceptHeaders() : array |
| 286 | 286 | { |
| 287 | 287 | return self::parseAcceptHeaders()->getMimeStrings(); |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - /** |
|
| 291 | - * Returns an instance of the accept headers parser, |
|
| 292 | - * to access information on the browser's accepted |
|
| 293 | - * mime types. |
|
| 294 | - * |
|
| 295 | - * @return Request_AcceptHeaders |
|
| 296 | - * @see Request::getAcceptHeaders() |
|
| 297 | - */ |
|
| 290 | + /** |
|
| 291 | + * Returns an instance of the accept headers parser, |
|
| 292 | + * to access information on the browser's accepted |
|
| 293 | + * mime types. |
|
| 294 | + * |
|
| 295 | + * @return Request_AcceptHeaders |
|
| 296 | + * @see Request::getAcceptHeaders() |
|
| 297 | + */ |
|
| 298 | 298 | public static function parseAcceptHeaders() : Request_AcceptHeaders |
| 299 | 299 | { |
| 300 | 300 | static $accept; |
@@ -342,14 +342,14 @@ discard block |
||
| 342 | 342 | return false; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - /** |
|
| 346 | - * Removes a single parameter from the request. |
|
| 347 | - * If the parameter has been registered, also |
|
| 348 | - * removes the registration info. |
|
| 349 | - * |
|
| 350 | - * @param string $name |
|
| 351 | - * @return Request |
|
| 352 | - */ |
|
| 345 | + /** |
|
| 346 | + * Removes a single parameter from the request. |
|
| 347 | + * If the parameter has been registered, also |
|
| 348 | + * removes the registration info. |
|
| 349 | + * |
|
| 350 | + * @param string $name |
|
| 351 | + * @return Request |
|
| 352 | + */ |
|
| 353 | 353 | public function removeParam(string $name) : Request |
| 354 | 354 | { |
| 355 | 355 | if(isset($_REQUEST[$name])) { |
@@ -363,12 +363,12 @@ discard block |
||
| 363 | 363 | return $this; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - /** |
|
| 367 | - * Removes several parameters from the request. |
|
| 368 | - * |
|
| 369 | - * @param string[] $names |
|
| 370 | - * @return Request |
|
| 371 | - */ |
|
| 366 | + /** |
|
| 367 | + * Removes several parameters from the request. |
|
| 368 | + * |
|
| 369 | + * @param string[] $names |
|
| 370 | + * @return Request |
|
| 371 | + */ |
|
| 372 | 372 | public function removeParams(array $names) : Request |
| 373 | 373 | { |
| 374 | 374 | foreach($names as $name) { |
@@ -435,18 +435,18 @@ discard block |
||
| 435 | 435 | return $val; |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | - /** |
|
| 439 | - * Treats the request parameter as a JSON string, and |
|
| 440 | - * if it exists and contains valid JSON, returns the |
|
| 441 | - * decoded JSON value as an array (default). |
|
| 442 | - * |
|
| 443 | - * @param string $name |
|
| 444 | - * @param bool $assoc |
|
| 445 | - * @return array|object |
|
| 446 | - * |
|
| 447 | - * @see Request::getJSONAssoc() |
|
| 448 | - * @see Request::getJSONObject() |
|
| 449 | - */ |
|
| 438 | + /** |
|
| 439 | + * Treats the request parameter as a JSON string, and |
|
| 440 | + * if it exists and contains valid JSON, returns the |
|
| 441 | + * decoded JSON value as an array (default). |
|
| 442 | + * |
|
| 443 | + * @param string $name |
|
| 444 | + * @param bool $assoc |
|
| 445 | + * @return array|object |
|
| 446 | + * |
|
| 447 | + * @see Request::getJSONAssoc() |
|
| 448 | + * @see Request::getJSONObject() |
|
| 449 | + */ |
|
| 450 | 450 | public function getJSON(string $name, bool $assoc=true) |
| 451 | 451 | { |
| 452 | 452 | $value = $this->getParam($name); |
@@ -471,13 +471,13 @@ discard block |
||
| 471 | 471 | return new \stdClass(); |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | - /** |
|
| 475 | - * Like {@link Request::getJSON()}, but omitting the second |
|
| 476 | - * parameter. Use this for more readable code. |
|
| 477 | - * |
|
| 478 | - * @param string $name |
|
| 479 | - * @return array |
|
| 480 | - */ |
|
| 474 | + /** |
|
| 475 | + * Like {@link Request::getJSON()}, but omitting the second |
|
| 476 | + * parameter. Use this for more readable code. |
|
| 477 | + * |
|
| 478 | + * @param string $name |
|
| 479 | + * @return array |
|
| 480 | + */ |
|
| 481 | 481 | public function getJSONAssoc(string $name) : array |
| 482 | 482 | { |
| 483 | 483 | $result = $this->getJSON($name); |
@@ -488,13 +488,13 @@ discard block |
||
| 488 | 488 | return array(); |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | - /** |
|
| 492 | - * Like {@link Request::getJSON()}, but omitting the second |
|
| 493 | - * parameter. Use this for more readable code. |
|
| 494 | - * |
|
| 495 | - * @param string $name |
|
| 496 | - * @return object |
|
| 497 | - */ |
|
| 491 | + /** |
|
| 492 | + * Like {@link Request::getJSON()}, but omitting the second |
|
| 493 | + * parameter. Use this for more readable code. |
|
| 494 | + * |
|
| 495 | + * @param string $name |
|
| 496 | + * @return object |
|
| 497 | + */ |
|
| 498 | 498 | public function getJSONObject(string $name) : object |
| 499 | 499 | { |
| 500 | 500 | $result = $this->getJSON($name, false); |
@@ -505,12 +505,12 @@ discard block |
||
| 505 | 505 | return new \stdClass(); |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | - /** |
|
| 509 | - * Sends a JSON response with the correct headers. |
|
| 510 | - * |
|
| 511 | - * @param array|string $data |
|
| 512 | - * @param bool $exit Whether to exit the script afterwards. |
|
| 513 | - */ |
|
| 508 | + /** |
|
| 509 | + * Sends a JSON response with the correct headers. |
|
| 510 | + * |
|
| 511 | + * @param array|string $data |
|
| 512 | + * @param bool $exit Whether to exit the script afterwards. |
|
| 513 | + */ |
|
| 514 | 514 | public static function sendJSON($data, bool $exit=true) |
| 515 | 515 | { |
| 516 | 516 | $payload = $data; |
@@ -530,12 +530,12 @@ discard block |
||
| 530 | 530 | } |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | - /** |
|
| 534 | - * Sends HTML to the browser with the correct headers. |
|
| 535 | - * |
|
| 536 | - * @param string $html |
|
| 537 | - * @param bool $exit Whether to exit the script afterwards. |
|
| 538 | - */ |
|
| 533 | + /** |
|
| 534 | + * Sends HTML to the browser with the correct headers. |
|
| 535 | + * |
|
| 536 | + * @param string $html |
|
| 537 | + * @param bool $exit Whether to exit the script afterwards. |
|
| 538 | + */ |
|
| 539 | 539 | public static function sendHTML(string $html, bool $exit=true) |
| 540 | 540 | { |
| 541 | 541 | header('Cache-Control: no-cache, must-revalidate'); |
@@ -550,16 +550,16 @@ discard block |
||
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | - /** |
|
| 554 | - * Creates a new instance of the URL comparer, which can check |
|
| 555 | - * whether the specified URLs match, regardless of the order in |
|
| 556 | - * which the query parameters are, if any. |
|
| 557 | - * |
|
| 558 | - * @param string $sourceURL |
|
| 559 | - * @param string $targetURL |
|
| 560 | - * @param array $limitParams Whether to limit the comparison to these specific parameter names (if present) |
|
| 561 | - * @return Request_URLComparer |
|
| 562 | - */ |
|
| 553 | + /** |
|
| 554 | + * Creates a new instance of the URL comparer, which can check |
|
| 555 | + * whether the specified URLs match, regardless of the order in |
|
| 556 | + * which the query parameters are, if any. |
|
| 557 | + * |
|
| 558 | + * @param string $sourceURL |
|
| 559 | + * @param string $targetURL |
|
| 560 | + * @param array $limitParams Whether to limit the comparison to these specific parameter names (if present) |
|
| 561 | + * @return Request_URLComparer |
|
| 562 | + */ |
|
| 563 | 563 | public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams=array()) : Request_URLComparer |
| 564 | 564 | { |
| 565 | 565 | $comparer = new Request_URLComparer($this, $sourceURL, $targetURL); |
@@ -568,10 +568,10 @@ discard block |
||
| 568 | 568 | return $comparer; |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | - /** |
|
| 572 | - * Retrieves the full URL that was used to access the current page. |
|
| 573 | - * @return string |
|
| 574 | - */ |
|
| 571 | + /** |
|
| 572 | + * Retrieves the full URL that was used to access the current page. |
|
| 573 | + * @return string |
|
| 574 | + */ |
|
| 575 | 575 | public function getCurrentURL() : string |
| 576 | 576 | { |
| 577 | 577 | return $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
@@ -19,9 +19,9 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class Request_RefreshParams_Exclude_Name extends Request_RefreshParams_Exclude |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * @var string |
|
| 24 | - */ |
|
| 22 | + /** |
|
| 23 | + * @var string |
|
| 24 | + */ |
|
| 25 | 25 | private $name; |
| 26 | 26 | |
| 27 | 27 | public function __construct(string $paramName) |
@@ -23,14 +23,14 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | use Traits_Optionable; |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @var array<string,mixed> |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var array<string,mixed> |
|
| 28 | + */ |
|
| 29 | 29 | private $overrides = array(); |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var Request_RefreshParams_Exclude[] |
|
| 33 | - */ |
|
| 31 | + /** |
|
| 32 | + * @var Request_RefreshParams_Exclude[] |
|
| 33 | + */ |
|
| 34 | 34 | private $excludes = array(); |
| 35 | 35 | |
| 36 | 36 | public function getDefaultOptions() : array |
@@ -41,27 +41,27 @@ discard block |
||
| 41 | 41 | ); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Whether to automatically exclude the session variable |
|
| 46 | - * from the parameters. |
|
| 47 | - * |
|
| 48 | - * @param bool $exclude |
|
| 49 | - * @return Request_RefreshParams |
|
| 50 | - */ |
|
| 44 | + /** |
|
| 45 | + * Whether to automatically exclude the session variable |
|
| 46 | + * from the parameters. |
|
| 47 | + * |
|
| 48 | + * @param bool $exclude |
|
| 49 | + * @return Request_RefreshParams |
|
| 50 | + */ |
|
| 51 | 51 | public function setExcludeSessionName(bool $exclude=true) : Request_RefreshParams |
| 52 | 52 | { |
| 53 | 53 | $this->setOption('exclude-session-name', $exclude); |
| 54 | 54 | return $this; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Whether to automatically exclude the HTML_QuickForm2 |
|
| 59 | - * request variable used to track whether a form has been |
|
| 60 | - * submitted. |
|
| 61 | - * |
|
| 62 | - * @param bool $exclude |
|
| 63 | - * @return Request_RefreshParams |
|
| 64 | - */ |
|
| 57 | + /** |
|
| 58 | + * Whether to automatically exclude the HTML_QuickForm2 |
|
| 59 | + * request variable used to track whether a form has been |
|
| 60 | + * submitted. |
|
| 61 | + * |
|
| 62 | + * @param bool $exclude |
|
| 63 | + * @return Request_RefreshParams |
|
| 64 | + */ |
|
| 65 | 65 | public function setExcludeQuickform(bool $exclude) : Request_RefreshParams |
| 66 | 66 | { |
| 67 | 67 | $this->setOption('exclude-quickform-submitter', $exclude); |
@@ -78,20 +78,20 @@ discard block |
||
| 78 | 78 | return $this; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Exclude a request using a callback function. |
|
| 83 | - * |
|
| 84 | - * The function gets two parameters: |
|
| 85 | - * |
|
| 86 | - * - The name of the request parameter |
|
| 87 | - * - The value of the request parameter |
|
| 88 | - * |
|
| 89 | - * If the callback returns a boolean true, the |
|
| 90 | - * parameter will be excluded. |
|
| 91 | - * |
|
| 92 | - * @param callable $callback |
|
| 93 | - * @return Request_RefreshParams |
|
| 94 | - */ |
|
| 81 | + /** |
|
| 82 | + * Exclude a request using a callback function. |
|
| 83 | + * |
|
| 84 | + * The function gets two parameters: |
|
| 85 | + * |
|
| 86 | + * - The name of the request parameter |
|
| 87 | + * - The value of the request parameter |
|
| 88 | + * |
|
| 89 | + * If the callback returns a boolean true, the |
|
| 90 | + * parameter will be excluded. |
|
| 91 | + * |
|
| 92 | + * @param callable $callback |
|
| 93 | + * @return Request_RefreshParams |
|
| 94 | + */ |
|
| 95 | 95 | public function excludeParamByCallback($callback) : Request_RefreshParams |
| 96 | 96 | { |
| 97 | 97 | $this->excludes[] = new Request_RefreshParams_Exclude_Callback($callback); |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | return $this; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * Excludes a request parameter by name. |
|
| 104 | - * |
|
| 105 | - * @param array $paramNames |
|
| 106 | - * @return Request_RefreshParams |
|
| 107 | - */ |
|
| 102 | + /** |
|
| 103 | + * Excludes a request parameter by name. |
|
| 104 | + * |
|
| 105 | + * @param array $paramNames |
|
| 106 | + * @return Request_RefreshParams |
|
| 107 | + */ |
|
| 108 | 108 | public function excludeParamsByName(array $paramNames) : Request_RefreshParams |
| 109 | 109 | { |
| 110 | 110 | foreach($paramNames as $name) |
@@ -115,15 +115,15 @@ discard block |
||
| 115 | 115 | return $this; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * Overrides a parameter: even if it exists, this |
|
| 120 | - * value will be used instead - even if it is on |
|
| 121 | - * the list of excluded parameters. |
|
| 122 | - * |
|
| 123 | - * @param string $paramName |
|
| 124 | - * @param mixed $paramValue |
|
| 125 | - * @return Request_RefreshParams |
|
| 126 | - */ |
|
| 118 | + /** |
|
| 119 | + * Overrides a parameter: even if it exists, this |
|
| 120 | + * value will be used instead - even if it is on |
|
| 121 | + * the list of excluded parameters. |
|
| 122 | + * |
|
| 123 | + * @param string $paramName |
|
| 124 | + * @param mixed $paramValue |
|
| 125 | + * @return Request_RefreshParams |
|
| 126 | + */ |
|
| 127 | 127 | public function overrideParam(string $paramName, $paramValue) : Request_RefreshParams |
| 128 | 128 | { |
| 129 | 129 | $this->overrides[$paramName] = $paramValue; |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | return $this; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - /** |
|
| 135 | - * Overrides an array of parameters. |
|
| 136 | - * |
|
| 137 | - * @param array $params |
|
| 138 | - * @return Request_RefreshParams |
|
| 139 | - */ |
|
| 134 | + /** |
|
| 135 | + * Overrides an array of parameters. |
|
| 136 | + * |
|
| 137 | + * @param array $params |
|
| 138 | + * @return Request_RefreshParams |
|
| 139 | + */ |
|
| 140 | 140 | public function overrideParams(array $params) : Request_RefreshParams |
| 141 | 141 | { |
| 142 | 142 | foreach($params as $name => $value) |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | return $this; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * Resolves all the parameter exclusions that should |
|
| 152 | - * be applied to the list of parameters. This includes |
|
| 153 | - * the manually added exclusions and the dynamic exclusions |
|
| 154 | - * like the session name. |
|
| 155 | - * |
|
| 156 | - * @return Request_RefreshParams_Exclude[] |
|
| 157 | - */ |
|
| 150 | + /** |
|
| 151 | + * Resolves all the parameter exclusions that should |
|
| 152 | + * be applied to the list of parameters. This includes |
|
| 153 | + * the manually added exclusions and the dynamic exclusions |
|
| 154 | + * like the session name. |
|
| 155 | + * |
|
| 156 | + * @return Request_RefreshParams_Exclude[] |
|
| 157 | + */ |
|
| 158 | 158 | private function resolveExcludes() : array |
| 159 | 159 | { |
| 160 | 160 | $excludes = $this->excludes; |
@@ -165,12 +165,12 @@ discard block |
||
| 165 | 165 | return $excludes; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - /** |
|
| 169 | - * Automatically excludes the session name from the |
|
| 170 | - * parameters, if present. |
|
| 171 | - * |
|
| 172 | - * @param Request_RefreshParams_Exclude[] $excludes |
|
| 173 | - */ |
|
| 168 | + /** |
|
| 169 | + * Automatically excludes the session name from the |
|
| 170 | + * parameters, if present. |
|
| 171 | + * |
|
| 172 | + * @param Request_RefreshParams_Exclude[] $excludes |
|
| 173 | + */ |
|
| 174 | 174 | private function autoExcludeSessionName(array &$excludes) : void |
| 175 | 175 | { |
| 176 | 176 | if($this->getBoolOption('exclude-session-name')) |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - /** |
|
| 183 | - * Automatically excludes the HTML_QuickForm2 submit |
|
| 184 | - * tracking variable, when enabled. |
|
| 185 | - * |
|
| 186 | - * @param Request_RefreshParams_Exclude[] $excludes |
|
| 187 | - */ |
|
| 182 | + /** |
|
| 183 | + * Automatically excludes the HTML_QuickForm2 submit |
|
| 184 | + * tracking variable, when enabled. |
|
| 185 | + * |
|
| 186 | + * @param Request_RefreshParams_Exclude[] $excludes |
|
| 187 | + */ |
|
| 188 | 188 | private function autoExcludeQuickform(array &$excludes) : void |
| 189 | 189 | { |
| 190 | 190 | if($this->getBoolOption('exclude-quickform-submitter')) |
@@ -196,12 +196,12 @@ discard block |
||
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - /** |
|
| 200 | - * Retrieves the list of parameters matching the |
|
| 201 | - * current settings. |
|
| 202 | - * |
|
| 203 | - * @return array<string,mixed> |
|
| 204 | - */ |
|
| 199 | + /** |
|
| 200 | + * Retrieves the list of parameters matching the |
|
| 201 | + * current settings. |
|
| 202 | + * |
|
| 203 | + * @return array<string,mixed> |
|
| 204 | + */ |
|
| 205 | 205 | public function getParams() : array |
| 206 | 206 | { |
| 207 | 207 | $params = $this->removeExcluded($_REQUEST); |
@@ -217,12 +217,12 @@ discard block |
||
| 217 | 217 | return $params; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - /** |
|
| 221 | - * Removes all excluded parameters from the array. |
|
| 222 | - * |
|
| 223 | - * @param array<string,mixed> $params |
|
| 224 | - * @return array<string,mixed> |
|
| 225 | - */ |
|
| 220 | + /** |
|
| 221 | + * Removes all excluded parameters from the array. |
|
| 222 | + * |
|
| 223 | + * @param array<string,mixed> $params |
|
| 224 | + * @return array<string,mixed> |
|
| 225 | + */ |
|
| 226 | 226 | private function removeExcluded(array $params) : array |
| 227 | 227 | { |
| 228 | 228 | $result = array(); |
@@ -240,14 +240,14 @@ discard block |
||
| 240 | 240 | return $result; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - /** |
|
| 244 | - * Checks all configured exclusions to see if the |
|
| 245 | - * parameter should be excluded or not. |
|
| 246 | - * |
|
| 247 | - * @param string $paramName |
|
| 248 | - * @param mixed $paramValue |
|
| 249 | - * @return bool |
|
| 250 | - */ |
|
| 243 | + /** |
|
| 244 | + * Checks all configured exclusions to see if the |
|
| 245 | + * parameter should be excluded or not. |
|
| 246 | + * |
|
| 247 | + * @param string $paramName |
|
| 248 | + * @param mixed $paramValue |
|
| 249 | + * @return bool |
|
| 250 | + */ |
|
| 251 | 251 | public function isExcluded(string $paramName, $paramValue) : bool |
| 252 | 252 | { |
| 253 | 253 | $excludes = $this->resolveExcludes(); |