@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | { |
42 | 42 | const ERROR_FAILED_CONVERTING_TO_JSON = 37901; |
43 | 43 | |
44 | - /** |
|
45 | - * @var \SimpleXMLElement |
|
46 | - */ |
|
44 | + /** |
|
45 | + * @var \SimpleXMLElement |
|
46 | + */ |
|
47 | 47 | protected $xml; |
48 | 48 | |
49 | - /** |
|
50 | - * @var string |
|
51 | - */ |
|
49 | + /** |
|
50 | + * @var string |
|
51 | + */ |
|
52 | 52 | protected $json; |
53 | 53 | |
54 | 54 | protected function __construct(\SimpleXMLElement $element) |
@@ -56,24 +56,24 @@ discard block |
||
56 | 56 | $this->xml = $element; |
57 | 57 | } |
58 | 58 | |
59 | - /** |
|
60 | - * Factory method: creates a converter from an XML file on disk. |
|
61 | - * |
|
62 | - * @param string $path |
|
63 | - * @return \AppUtils\XMLHelper_Converter |
|
64 | - */ |
|
59 | + /** |
|
60 | + * Factory method: creates a converter from an XML file on disk. |
|
61 | + * |
|
62 | + * @param string $path |
|
63 | + * @return \AppUtils\XMLHelper_Converter |
|
64 | + */ |
|
65 | 65 | public static function fromFile(string $path) |
66 | 66 | { |
67 | 67 | $xmlString = file_get_contents($path); |
68 | 68 | return self::fromString($xmlString); |
69 | 69 | } |
70 | 70 | |
71 | - /** |
|
72 | - * Factory method: creates a converter from an XML string. |
|
73 | - * |
|
74 | - * @param string $xmlString |
|
75 | - * @return \AppUtils\XMLHelper_Converter |
|
76 | - */ |
|
71 | + /** |
|
72 | + * Factory method: creates a converter from an XML string. |
|
73 | + * |
|
74 | + * @param string $xmlString |
|
75 | + * @return \AppUtils\XMLHelper_Converter |
|
76 | + */ |
|
77 | 77 | public static function fromString(string $xmlString) |
78 | 78 | { |
79 | 79 | $element = new \SimpleXMLElement($xmlString); |
@@ -81,36 +81,36 @@ discard block |
||
81 | 81 | return self::fromElement($element); |
82 | 82 | } |
83 | 83 | |
84 | - /** |
|
85 | - * Factory method: creates a converter from an existing SimpleXMLElement instance. |
|
86 | - * |
|
87 | - * @param \SimpleXMLElement $element |
|
88 | - * @return \AppUtils\XMLHelper_Converter |
|
89 | - */ |
|
84 | + /** |
|
85 | + * Factory method: creates a converter from an existing SimpleXMLElement instance. |
|
86 | + * |
|
87 | + * @param \SimpleXMLElement $element |
|
88 | + * @return \AppUtils\XMLHelper_Converter |
|
89 | + */ |
|
90 | 90 | public static function fromElement(\SimpleXMLElement $element) |
91 | 91 | { |
92 | 92 | $obj = new XMLHelper_Converter($element); |
93 | 93 | return $obj; |
94 | 94 | } |
95 | 95 | |
96 | - /** |
|
97 | - * Factory method: creates a converter from an existing SimpleXMLElement instance. |
|
98 | - * |
|
99 | - * @param \DOMElement $element |
|
100 | - * @return \AppUtils\XMLHelper_Converter |
|
101 | - */ |
|
96 | + /** |
|
97 | + * Factory method: creates a converter from an existing SimpleXMLElement instance. |
|
98 | + * |
|
99 | + * @param \DOMElement $element |
|
100 | + * @return \AppUtils\XMLHelper_Converter |
|
101 | + */ |
|
102 | 102 | public static function fromDOMElement(\DOMElement $element) |
103 | 103 | { |
104 | 104 | $obj = new XMLHelper_Converter(simplexml_import_dom($element)); |
105 | 105 | return $obj; |
106 | 106 | } |
107 | 107 | |
108 | - /** |
|
109 | - * Converts the XML to JSON. |
|
110 | - * |
|
111 | - * @throws XMLHelper_Exception |
|
112 | - * @return string |
|
113 | - */ |
|
108 | + /** |
|
109 | + * Converts the XML to JSON. |
|
110 | + * |
|
111 | + * @throws XMLHelper_Exception |
|
112 | + * @return string |
|
113 | + */ |
|
114 | 114 | public function toJSON() : string |
115 | 115 | { |
116 | 116 | if(isset($this->json)) { |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | ); |
139 | 139 | } |
140 | 140 | |
141 | - /** |
|
142 | - * Converts the XML to an associative array. |
|
143 | - * @return array |
|
144 | - * @throws XMLHelper_Exception |
|
145 | - */ |
|
141 | + /** |
|
142 | + * Converts the XML to an associative array. |
|
143 | + * @return array |
|
144 | + * @throws XMLHelper_Exception |
|
145 | + */ |
|
146 | 146 | public function toArray() : array |
147 | 147 | { |
148 | 148 | $json = $this->toJSON(); |
@@ -11,27 +11,27 @@ |
||
11 | 11 | |
12 | 12 | protected $errors = array(); |
13 | 13 | |
14 | - /** |
|
15 | - * Creates a simplexml instance from an XML string. |
|
16 | - * |
|
17 | - * NOTE: returns false in case of a fatal error. |
|
18 | - * |
|
19 | - * @param string $string |
|
20 | - * @return \SimpleXMLElement|bool |
|
21 | - */ |
|
14 | + /** |
|
15 | + * Creates a simplexml instance from an XML string. |
|
16 | + * |
|
17 | + * NOTE: returns false in case of a fatal error. |
|
18 | + * |
|
19 | + * @param string $string |
|
20 | + * @return \SimpleXMLElement|bool |
|
21 | + */ |
|
22 | 22 | public function loadString($string) |
23 | 23 | { |
24 | 24 | return $this->load('string', $string); |
25 | 25 | } |
26 | 26 | |
27 | - /** |
|
28 | - * Creates a simplexml instance from an XML file. |
|
29 | - * |
|
30 | - * NOTE: returns false in case of a fatal error. |
|
31 | - * |
|
32 | - * @param string $file |
|
33 | - * @return \SimpleXMLElement|bool |
|
34 | - */ |
|
27 | + /** |
|
28 | + * Creates a simplexml instance from an XML file. |
|
29 | + * |
|
30 | + * NOTE: returns false in case of a fatal error. |
|
31 | + * |
|
32 | + * @param string $file |
|
33 | + * @return \SimpleXMLElement|bool |
|
34 | + */ |
|
35 | 35 | public function loadFile($file) |
36 | 36 | { |
37 | 37 | return $this->load('file', $file); |
@@ -111,18 +111,18 @@ discard block |
||
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | - /** |
|
115 | - * Adds a callback as a validation method. The callback gets the |
|
116 | - * value to validate as first parameter, and any additional |
|
117 | - * parameters passed here get appended to that. |
|
118 | - * |
|
119 | - * The callback must return boolean true or false depending on |
|
120 | - * whether the value is valid. |
|
121 | - * |
|
122 | - * @param mixed $callback |
|
123 | - * @param array $args |
|
124 | - * @return Request_Param |
|
125 | - */ |
|
114 | + /** |
|
115 | + * Adds a callback as a validation method. The callback gets the |
|
116 | + * value to validate as first parameter, and any additional |
|
117 | + * parameters passed here get appended to that. |
|
118 | + * |
|
119 | + * The callback must return boolean true or false depending on |
|
120 | + * whether the value is valid. |
|
121 | + * |
|
122 | + * @param mixed $callback |
|
123 | + * @param array $args |
|
124 | + * @return Request_Param |
|
125 | + */ |
|
126 | 126 | public function setCallback($callback, $args=array()) |
127 | 127 | { |
128 | 128 | if(!is_callable($callback)) { |
@@ -264,13 +264,13 @@ discard block |
||
264 | 264 | |
265 | 265 | protected $valueType = self::VALUE_TYPE_STRING; |
266 | 266 | |
267 | - /** |
|
268 | - * Sets the variable to contain a comma-separated list of integer IDs. |
|
269 | - * Example: <code>145,248,4556</code>. A single ID is also allowed, e.g. |
|
270 | - * <code>145</code>. |
|
271 | - * |
|
272 | - * @return Request_Param |
|
273 | - */ |
|
267 | + /** |
|
268 | + * Sets the variable to contain a comma-separated list of integer IDs. |
|
269 | + * Example: <code>145,248,4556</code>. A single ID is also allowed, e.g. |
|
270 | + * <code>145</code>. |
|
271 | + * |
|
272 | + * @return Request_Param |
|
273 | + */ |
|
274 | 274 | public function setIDList() |
275 | 275 | { |
276 | 276 | $this->valueType = self::VALUE_TYPE_ID_LIST; |
@@ -279,13 +279,13 @@ discard block |
||
279 | 279 | return $this; |
280 | 280 | } |
281 | 281 | |
282 | - /** |
|
283 | - * Sets the variable to be an alias, as defined by the |
|
284 | - * {@link RegexHelper::REGEX_ALIAS} regular expression. |
|
285 | - * |
|
286 | - * @return Request_Param |
|
287 | - * @see RegexHelper::REGEX_ALIAS |
|
288 | - */ |
|
282 | + /** |
|
283 | + * Sets the variable to be an alias, as defined by the |
|
284 | + * {@link RegexHelper::REGEX_ALIAS} regular expression. |
|
285 | + * |
|
286 | + * @return Request_Param |
|
287 | + * @see RegexHelper::REGEX_ALIAS |
|
288 | + */ |
|
289 | 289 | public function setAlias() |
290 | 290 | { |
291 | 291 | return $this->setRegex(RegexHelper::REGEX_ALIAS); |
@@ -326,12 +326,12 @@ discard block |
||
326 | 326 | return $this->setValidation(self::VALIDATION_TYPE_ALPHA); |
327 | 327 | } |
328 | 328 | |
329 | - /** |
|
330 | - * Sets the parameter value as a string containing lowercase |
|
331 | - * and/or uppercase letters, as well as numbers. |
|
332 | - * |
|
333 | - * @return Request_Param |
|
334 | - */ |
|
329 | + /** |
|
330 | + * Sets the parameter value as a string containing lowercase |
|
331 | + * and/or uppercase letters, as well as numbers. |
|
332 | + * |
|
333 | + * @return Request_Param |
|
334 | + */ |
|
335 | 335 | public function setAlnum() |
336 | 336 | { |
337 | 337 | return $this->setValidation(self::VALIDATION_TYPE_ALNUM); |
@@ -359,17 +359,17 @@ discard block |
||
359 | 359 | return $this->setValidation(self::VALIDATION_TYPE_ENUM, $args); |
360 | 360 | } |
361 | 361 | |
362 | - /** |
|
363 | - * Only available for array values: the parameter must be |
|
364 | - * an array value, and the array may only contain values |
|
365 | - * specified in the values array. |
|
366 | - * |
|
367 | - * Submitted values that are not in the allowed list of |
|
368 | - * values are stripped from the value. |
|
369 | - * |
|
370 | - * @param array $values List of allowed values |
|
371 | - * @return \AppUtils\Request_Param |
|
372 | - */ |
|
362 | + /** |
|
363 | + * Only available for array values: the parameter must be |
|
364 | + * an array value, and the array may only contain values |
|
365 | + * specified in the values array. |
|
366 | + * |
|
367 | + * Submitted values that are not in the allowed list of |
|
368 | + * values are stripped from the value. |
|
369 | + * |
|
370 | + * @param array $values List of allowed values |
|
371 | + * @return \AppUtils\Request_Param |
|
372 | + */ |
|
373 | 373 | public function setValuesList(array $values) |
374 | 374 | { |
375 | 375 | $this->setArray(); |
@@ -382,39 +382,39 @@ discard block |
||
382 | 382 | return $this->setValidation(self::VALIDATION_TYPE_ARRAY); |
383 | 383 | } |
384 | 384 | |
385 | - /** |
|
386 | - * Specifies that a JSON-encoded string is expected. |
|
387 | - * |
|
388 | - * NOTE: Numbers or quoted strings are technically valid |
|
389 | - * JSON, but are not accepted, because it is assumed |
|
390 | - * at least an array or object are expected. |
|
391 | - * |
|
392 | - * @return \AppUtils\Request_Param |
|
393 | - */ |
|
385 | + /** |
|
386 | + * Specifies that a JSON-encoded string is expected. |
|
387 | + * |
|
388 | + * NOTE: Numbers or quoted strings are technically valid |
|
389 | + * JSON, but are not accepted, because it is assumed |
|
390 | + * at least an array or object are expected. |
|
391 | + * |
|
392 | + * @return \AppUtils\Request_Param |
|
393 | + */ |
|
394 | 394 | public function setJSON() : Request_Param |
395 | 395 | { |
396 | 396 | return $this->setValidation(self::VALIDATION_TYPE_JSON, array('arrays' => true)); |
397 | 397 | } |
398 | 398 | |
399 | - /** |
|
400 | - * Like {@link Request_Param::setJSON()}, but accepts |
|
401 | - * only JSON objects. Arrays will not be accepted. |
|
402 | - * |
|
403 | - * @return \AppUtils\Request_Param |
|
404 | - */ |
|
399 | + /** |
|
400 | + * Like {@link Request_Param::setJSON()}, but accepts |
|
401 | + * only JSON objects. Arrays will not be accepted. |
|
402 | + * |
|
403 | + * @return \AppUtils\Request_Param |
|
404 | + */ |
|
405 | 405 | public function setJSONObject() : Request_Param |
406 | 406 | { |
407 | 407 | return $this->setValidation(self::VALIDATION_TYPE_JSON, array('arrays' => false)); |
408 | 408 | } |
409 | 409 | |
410 | - /** |
|
411 | - * The parameter is a string boolean representation. This means |
|
412 | - * it can be any of the following: "yes", "true", "no", "false". |
|
413 | - * The value is automatically converted to a boolean when retrieving |
|
414 | - * the parameter. |
|
415 | - * |
|
416 | - * @return Request_Param |
|
417 | - */ |
|
410 | + /** |
|
411 | + * The parameter is a string boolean representation. This means |
|
412 | + * it can be any of the following: "yes", "true", "no", "false". |
|
413 | + * The value is automatically converted to a boolean when retrieving |
|
414 | + * the parameter. |
|
415 | + * |
|
416 | + * @return Request_Param |
|
417 | + */ |
|
418 | 418 | public function setBoolean() : Request_Param |
419 | 419 | { |
420 | 420 | $this->addCallbackFilter(array($this, 'applyFilter_boolean')); |
@@ -478,15 +478,15 @@ discard block |
||
478 | 478 | return $keep; |
479 | 479 | } |
480 | 480 | |
481 | - /** |
|
482 | - * Validates the request parameter as an MD5 string, |
|
483 | - * so that only values resembling md5 values are accepted. |
|
484 | - * |
|
485 | - * NOTE: This can only guarantee the format, not whether |
|
486 | - * it is an actual valid hash of something. |
|
487 | - * |
|
488 | - * @return \AppUtils\Request_Param |
|
489 | - */ |
|
481 | + /** |
|
482 | + * Validates the request parameter as an MD5 string, |
|
483 | + * so that only values resembling md5 values are accepted. |
|
484 | + * |
|
485 | + * NOTE: This can only guarantee the format, not whether |
|
486 | + * it is an actual valid hash of something. |
|
487 | + * |
|
488 | + * @return \AppUtils\Request_Param |
|
489 | + */ |
|
490 | 490 | public function setMD5() : Request_Param |
491 | 491 | { |
492 | 492 | return $this->setRegex(RegexHelper::REGEX_MD5); |
@@ -528,14 +528,14 @@ discard block |
||
528 | 528 | return $this; |
529 | 529 | } |
530 | 530 | |
531 | - /** |
|
532 | - * Retrieves the value of the request parameter, |
|
533 | - * applying all filters (if any) and validation |
|
534 | - * (if any). |
|
535 | - * |
|
536 | - * @param mixed $default |
|
537 | - * @return mixed |
|
538 | - */ |
|
531 | + /** |
|
532 | + * Retrieves the value of the request parameter, |
|
533 | + * applying all filters (if any) and validation |
|
534 | + * (if any). |
|
535 | + * |
|
536 | + * @param mixed $default |
|
537 | + * @return mixed |
|
538 | + */ |
|
539 | 539 | public function get($default=null) |
540 | 540 | { |
541 | 541 | $value = $this->validate($this->request->getParam($this->paramName)); |
@@ -566,11 +566,11 @@ discard block |
||
566 | 566 | return $int; |
567 | 567 | } |
568 | 568 | |
569 | - /** |
|
570 | - * Validates the syntax of an URL, but not its actual validity. |
|
571 | - * @param string $value |
|
572 | - * @return string |
|
573 | - */ |
|
569 | + /** |
|
570 | + * Validates the syntax of an URL, but not its actual validity. |
|
571 | + * @param string $value |
|
572 | + * @return string |
|
573 | + */ |
|
574 | 574 | protected function validate_url($value) : string |
575 | 575 | { |
576 | 576 | if(!is_string($value)) { |
@@ -689,10 +689,10 @@ discard block |
||
689 | 689 | return null; |
690 | 690 | } |
691 | 691 | |
692 | - /** |
|
693 | - * Makes sure that the value is a JSON-encoded string. |
|
694 | - * @param string $value |
|
695 | - */ |
|
692 | + /** |
|
693 | + * Makes sure that the value is a JSON-encoded string. |
|
694 | + * @param string $value |
|
695 | + */ |
|
696 | 696 | protected function validate_json($value) |
697 | 697 | { |
698 | 698 | if(!is_string($value)) { |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | if($this->validationParams['arrays'] === false) |
710 | 710 | { |
711 | 711 | if(is_object(json_decode($value))) { |
712 | - return $value; |
|
712 | + return $value; |
|
713 | 713 | } |
714 | 714 | } |
715 | 715 | else |
@@ -790,12 +790,12 @@ discard block |
||
790 | 790 | return $this; |
791 | 791 | } |
792 | 792 | |
793 | - /** |
|
794 | - * Adds a filter that trims whitespace from the request |
|
795 | - * parameter using the PHP <code>trim</code> function. |
|
796 | - * |
|
797 | - * @return \AppUtils\Request_Param |
|
798 | - */ |
|
793 | + /** |
|
794 | + * Adds a filter that trims whitespace from the request |
|
795 | + * parameter using the PHP <code>trim</code> function. |
|
796 | + * |
|
797 | + * @return \AppUtils\Request_Param |
|
798 | + */ |
|
799 | 799 | public function addFilterTrim() : Request_Param |
800 | 800 | { |
801 | 801 | // to guarantee we only work with strings |
@@ -804,13 +804,13 @@ discard block |
||
804 | 804 | return $this->addCallbackFilter('trim'); |
805 | 805 | } |
806 | 806 | |
807 | - /** |
|
808 | - * Converts the value to a string, even if it is not |
|
809 | - * a string value. Complex types like arrays and objects |
|
810 | - * are converted to an empty string. |
|
811 | - * |
|
812 | - * @return \AppUtils\Request_Param |
|
813 | - */ |
|
807 | + /** |
|
808 | + * Converts the value to a string, even if it is not |
|
809 | + * a string value. Complex types like arrays and objects |
|
810 | + * are converted to an empty string. |
|
811 | + * |
|
812 | + * @return \AppUtils\Request_Param |
|
813 | + */ |
|
814 | 814 | public function addStringFilter() : Request_Param |
815 | 815 | { |
816 | 816 | return $this->addCallbackFilter(array($this, 'applyFilter_string')); |
@@ -860,12 +860,12 @@ discard block |
||
860 | 860 | return $this->addCallbackFilter('strip_tags', array($allowedTags)); |
861 | 861 | } |
862 | 862 | |
863 | - /** |
|
864 | - * Adds a filter that strips all whitespace from the |
|
865 | - * request parameter, from spaces to tabs and newlines. |
|
866 | - * |
|
867 | - * @return \AppUtils\Request_Param |
|
868 | - */ |
|
863 | + /** |
|
864 | + * Adds a filter that strips all whitespace from the |
|
865 | + * request parameter, from spaces to tabs and newlines. |
|
866 | + * |
|
867 | + * @return \AppUtils\Request_Param |
|
868 | + */ |
|
869 | 869 | public function addStripWhitespaceFilter() : Request_Param |
870 | 870 | { |
871 | 871 | // to ensure we only work with strings. |
@@ -874,14 +874,14 @@ discard block |
||
874 | 874 | return $this->addCallbackFilter(array($this, 'applyFilter_stripWhitespace')); |
875 | 875 | } |
876 | 876 | |
877 | - /** |
|
878 | - * Adds a filter that transforms comma separated values |
|
879 | - * into an array of values. |
|
880 | - * |
|
881 | - * @param bool $trimEntries Trim whitespace from each entry? |
|
882 | - * @param bool $stripEmptyEntries Remove empty entries from the array? |
|
883 | - * @return \AppUtils\Request_Param |
|
884 | - */ |
|
877 | + /** |
|
878 | + * Adds a filter that transforms comma separated values |
|
879 | + * into an array of values. |
|
880 | + * |
|
881 | + * @param bool $trimEntries Trim whitespace from each entry? |
|
882 | + * @param bool $stripEmptyEntries Remove empty entries from the array? |
|
883 | + * @return \AppUtils\Request_Param |
|
884 | + */ |
|
885 | 885 | public function addCommaSeparatedFilter(bool $trimEntries=true, bool $stripEmptyEntries=true) : Request_Param |
886 | 886 | { |
887 | 887 | $this->setArray(); |
@@ -895,12 +895,12 @@ discard block |
||
895 | 895 | ); |
896 | 896 | } |
897 | 897 | |
898 | - /** |
|
899 | - * Adds a filter that encodes all HTML special characters |
|
900 | - * using the PHP <code>htmlspecialchars</code> function. |
|
901 | - * |
|
902 | - * @return \AppUtils\Request_Param |
|
903 | - */ |
|
898 | + /** |
|
899 | + * Adds a filter that encodes all HTML special characters |
|
900 | + * using the PHP <code>htmlspecialchars</code> function. |
|
901 | + * |
|
902 | + * @return \AppUtils\Request_Param |
|
903 | + */ |
|
904 | 904 | public function addHTMLSpecialcharsFilter() : Request_Param |
905 | 905 | { |
906 | 906 | return $this->addCallbackFilter('htmlspecialchars', array(ENT_QUOTES, 'UTF-8')); |
@@ -913,14 +913,14 @@ discard block |
||
913 | 913 | |
914 | 914 | protected $required = false; |
915 | 915 | |
916 | - /** |
|
917 | - * Marks this request parameter as required. To use this feature, |
|
918 | - * you have to call the request's {@link Request::validate()} |
|
919 | - * method. |
|
920 | - * |
|
921 | - * @return Request_Param |
|
922 | - * @see Request::validate() |
|
923 | - */ |
|
916 | + /** |
|
917 | + * Marks this request parameter as required. To use this feature, |
|
918 | + * you have to call the request's {@link Request::validate()} |
|
919 | + * method. |
|
920 | + * |
|
921 | + * @return Request_Param |
|
922 | + * @see Request::validate() |
|
923 | + */ |
|
924 | 924 | public function makeRequired() : Request_Param |
925 | 925 | { |
926 | 926 | $this->required = true; |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | |
43 | 43 | const REGEX_MD5 = '/^[a-f0-9]{32}$/i'; |
44 | 44 | |
45 | - /** |
|
46 | - * @var string |
|
47 | - * @see https://en.wikipedia.org/wiki/Email_address#Local-part |
|
48 | - */ |
|
45 | + /** |
|
46 | + * @var string |
|
47 | + * @see https://en.wikipedia.org/wiki/Email_address#Local-part |
|
48 | + */ |
|
49 | 49 | const REGEX_EMAIL = '/[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i'; |
50 | 50 | |
51 | 51 | const REGEX_PHONE = '/\A[+0-9][0-9 +\-()]+\z/m'; |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | */ |
98 | 98 | const REGEX_IS_HTML = '%<{0,1}[a-z\/][\s\S]*>|<[a-z\/][\s\S]*>{0,1}%i'; |
99 | 99 | |
100 | - /** |
|
101 | - * Hexadecimal color codes. Allows the following formats: |
|
102 | - * |
|
103 | - * FFFFFF |
|
104 | - * FFF |
|
105 | - * |
|
106 | - * @var string |
|
107 | - */ |
|
100 | + /** |
|
101 | + * Hexadecimal color codes. Allows the following formats: |
|
102 | + * |
|
103 | + * FFFFFF |
|
104 | + * FFF |
|
105 | + * |
|
106 | + * @var string |
|
107 | + */ |
|
108 | 108 | const REGEX_HEX_COLOR_CODE = '/\A(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{3})\z/iU'; |
109 | 109 | } |
@@ -32,24 +32,24 @@ discard block |
||
32 | 32 | self::TYPE_CALLABLE => 'cf5e20' |
33 | 33 | ); |
34 | 34 | |
35 | - /** |
|
36 | - * @var string |
|
37 | - */ |
|
35 | + /** |
|
36 | + * @var string |
|
37 | + */ |
|
38 | 38 | protected $string; |
39 | 39 | |
40 | - /** |
|
41 | - * @var array |
|
42 | - */ |
|
40 | + /** |
|
41 | + * @var array |
|
42 | + */ |
|
43 | 43 | protected $value; |
44 | 44 | |
45 | - /** |
|
46 | - * @var string |
|
47 | - */ |
|
45 | + /** |
|
46 | + * @var string |
|
47 | + */ |
|
48 | 48 | protected $type; |
49 | 49 | |
50 | - /** |
|
51 | - * @param mixed $value |
|
52 | - */ |
|
50 | + /** |
|
51 | + * @param mixed $value |
|
52 | + */ |
|
53 | 53 | public function __construct($value, $serialized=null) |
54 | 54 | { |
55 | 55 | if(is_array($serialized)) |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | ); |
106 | 106 | } |
107 | 107 | |
108 | - /** |
|
109 | - * Whether to prepend the variable type before the value, |
|
110 | - * like the var_dump function. Example: <code>string "Some text"</code>. |
|
111 | - * |
|
112 | - * @param bool $enable |
|
113 | - * @return VariableInfo |
|
114 | - */ |
|
108 | + /** |
|
109 | + * Whether to prepend the variable type before the value, |
|
110 | + * like the var_dump function. Example: <code>string "Some text"</code>. |
|
111 | + * |
|
112 | + * @param bool $enable |
|
113 | + * @return VariableInfo |
|
114 | + */ |
|
115 | 115 | public function enableType(bool $enable=true) : VariableInfo |
116 | 116 | { |
117 | 117 | return $this->setOption('prepend-type', $enable); |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | $this->details = $details; |
14 | 14 | } |
15 | 15 | |
16 | - /** |
|
17 | - * Retrieves the detailed error description, if any. |
|
18 | - * @return string |
|
19 | - */ |
|
16 | + /** |
|
17 | + * Retrieves the detailed error description, if any. |
|
18 | + * @return string |
|
19 | + */ |
|
20 | 20 | public function getDetails() : string |
21 | 21 | { |
22 | 22 | if($this->details !== null) { |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | return ''; |
27 | 27 | } |
28 | 28 | |
29 | - /** |
|
30 | - * Displays pertinent information on the exception in |
|
31 | - * the browser, and exits the script. |
|
32 | - */ |
|
29 | + /** |
|
30 | + * Displays pertinent information on the exception in |
|
31 | + * the browser, and exits the script. |
|
32 | + */ |
|
33 | 33 | public function display() |
34 | 34 | { |
35 | 35 | if(!headers_sent()) { |
@@ -40,20 +40,20 @@ discard block |
||
40 | 40 | exit; |
41 | 41 | } |
42 | 42 | |
43 | - /** |
|
44 | - * Retrieves information on the exception that can be |
|
45 | - * easily accessed. |
|
46 | - * |
|
47 | - * @return ConvertHelper_ThrowableInfo |
|
48 | - */ |
|
43 | + /** |
|
44 | + * Retrieves information on the exception that can be |
|
45 | + * easily accessed. |
|
46 | + * |
|
47 | + * @return ConvertHelper_ThrowableInfo |
|
48 | + */ |
|
49 | 49 | public function getInfo() : ConvertHelper_ThrowableInfo |
50 | 50 | { |
51 | 51 | return ConvertHelper::throwable2info($this); |
52 | 52 | } |
53 | 53 | |
54 | - /** |
|
55 | - * Dumps a current PHP function trace, as a textonly string. |
|
56 | - */ |
|
54 | + /** |
|
55 | + * Dumps a current PHP function trace, as a textonly string. |
|
56 | + */ |
|
57 | 57 | public static function dumpTraceAsString() |
58 | 58 | { |
59 | 59 | try |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - /** |
|
87 | - * Creates an exception info instance from a throwable instance. |
|
88 | - * |
|
89 | - * @param \Throwable $e |
|
90 | - * @return ConvertHelper_ThrowableInfo |
|
91 | - * @see ConvertHelper::throwable2info() |
|
92 | - */ |
|
86 | + /** |
|
87 | + * Creates an exception info instance from a throwable instance. |
|
88 | + * |
|
89 | + * @param \Throwable $e |
|
90 | + * @return ConvertHelper_ThrowableInfo |
|
91 | + * @see ConvertHelper::throwable2info() |
|
92 | + */ |
|
93 | 93 | public static function createInfo(\Throwable $e) : ConvertHelper_ThrowableInfo |
94 | 94 | { |
95 | 95 | return ConvertHelper::throwable2info($e); |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | |
53 | 53 | } |
54 | 54 | |
55 | - /** |
|
56 | - * Creates and returns a new instance of the CSV builder which |
|
57 | - * can be used to build CSV from scratch. |
|
58 | - * |
|
59 | - * @return CSVHelper_Builder |
|
60 | - */ |
|
55 | + /** |
|
56 | + * Creates and returns a new instance of the CSV builder which |
|
57 | + * can be used to build CSV from scratch. |
|
58 | + * |
|
59 | + * @return CSVHelper_Builder |
|
60 | + */ |
|
61 | 61 | public static function createBuilder() |
62 | 62 | { |
63 | 63 | return new CSVHelper_Builder(); |
@@ -71,16 +71,16 @@ discard block |
||
71 | 71 | |
72 | 72 | protected $headersPosition = self::HEADERS_NONE; |
73 | 73 | |
74 | - /** |
|
75 | - * Loads CSV data from a string. |
|
76 | - * |
|
77 | - * Note: Use the {@link hasErrors()} method to |
|
78 | - * check if the string could be parsed correctly |
|
79 | - * afterwards. |
|
80 | - * |
|
81 | - * @param string $string |
|
82 | - * @return CSVHelper |
|
83 | - */ |
|
74 | + /** |
|
75 | + * Loads CSV data from a string. |
|
76 | + * |
|
77 | + * Note: Use the {@link hasErrors()} method to |
|
78 | + * check if the string could be parsed correctly |
|
79 | + * afterwards. |
|
80 | + * |
|
81 | + * @param string $string |
|
82 | + * @return CSVHelper |
|
83 | + */ |
|
84 | 84 | public function loadString($string) |
85 | 85 | { |
86 | 86 | // remove any UTF byte order marks that may still be present in the string |
@@ -94,17 +94,17 @@ discard block |
||
94 | 94 | return $this; |
95 | 95 | } |
96 | 96 | |
97 | - /** |
|
98 | - * Loads CSV data from a file. |
|
99 | - * |
|
100 | - * Note: Use the {@link hasErrors()} method to |
|
101 | - * check if the string could be parsed correctly |
|
102 | - * afterwards. |
|
103 | - * |
|
104 | - * @param string $file |
|
105 | - * @throws CSVHelper_Exception |
|
106 | - * @return boolean |
|
107 | - */ |
|
97 | + /** |
|
98 | + * Loads CSV data from a file. |
|
99 | + * |
|
100 | + * Note: Use the {@link hasErrors()} method to |
|
101 | + * check if the string could be parsed correctly |
|
102 | + * afterwards. |
|
103 | + * |
|
104 | + * @param string $file |
|
105 | + * @throws CSVHelper_Exception |
|
106 | + * @return boolean |
|
107 | + */ |
|
108 | 108 | public function loadFile($file) |
109 | 109 | { |
110 | 110 | $csv = file_get_contents($file); |
@@ -128,28 +128,28 @@ discard block |
||
128 | 128 | |
129 | 129 | protected $rowCount = 0; |
130 | 130 | |
131 | - /** |
|
132 | - * Specifies that headers are positioned on top, horizontally. |
|
133 | - * @return CSVHelper |
|
134 | - */ |
|
131 | + /** |
|
132 | + * Specifies that headers are positioned on top, horizontally. |
|
133 | + * @return CSVHelper |
|
134 | + */ |
|
135 | 135 | public function setHeadersTop() |
136 | 136 | { |
137 | 137 | return $this->setHeadersPosition(self::HEADERS_TOP); |
138 | 138 | } |
139 | 139 | |
140 | - /** |
|
141 | - * Specifies that headers are positioned on the left, vertically. |
|
142 | - * @return CSVHelper |
|
143 | - */ |
|
140 | + /** |
|
141 | + * Specifies that headers are positioned on the left, vertically. |
|
142 | + * @return CSVHelper |
|
143 | + */ |
|
144 | 144 | public function setHeadersLeft() |
145 | 145 | { |
146 | 146 | return $this->setHeadersPosition(self::HEADERS_LEFT); |
147 | 147 | } |
148 | 148 | |
149 | - /** |
|
150 | - * Specifies that there are no headers in the file (default). |
|
151 | - * @return CSVHelper |
|
152 | - */ |
|
149 | + /** |
|
150 | + * Specifies that there are no headers in the file (default). |
|
151 | + * @return CSVHelper |
|
152 | + */ |
|
153 | 153 | public function setHeadersNone() |
154 | 154 | { |
155 | 155 | return $this->setHeadersPosition(self::HEADERS_NONE); |
@@ -179,18 +179,18 @@ discard block |
||
179 | 179 | return false; |
180 | 180 | } |
181 | 181 | |
182 | - /** |
|
183 | - * Specifies where the headers are positioned in the |
|
184 | - * CSV, or turns them off entirely. Use the class constants |
|
185 | - * to ensure the value is correct. |
|
186 | - * |
|
187 | - * @param string $position |
|
188 | - * @throws CSVHelper_Exception |
|
189 | - * @return CSVHelper |
|
190 | - * @see CSVHelper::HEADERS_LEFT |
|
191 | - * @see CSVHelper::HEADERS_TOP |
|
192 | - * @see CSVHelper::HEADERS_NONE |
|
193 | - */ |
|
182 | + /** |
|
183 | + * Specifies where the headers are positioned in the |
|
184 | + * CSV, or turns them off entirely. Use the class constants |
|
185 | + * to ensure the value is correct. |
|
186 | + * |
|
187 | + * @param string $position |
|
188 | + * @throws CSVHelper_Exception |
|
189 | + * @return CSVHelper |
|
190 | + * @see CSVHelper::HEADERS_LEFT |
|
191 | + * @see CSVHelper::HEADERS_TOP |
|
192 | + * @see CSVHelper::HEADERS_NONE |
|
193 | + */ |
|
194 | 194 | public function setHeadersPosition($position) |
195 | 195 | { |
196 | 196 | $validPositions = array( |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | return $this; |
218 | 218 | } |
219 | 219 | |
220 | - /** |
|
221 | - * Resets all internal data, allowing to start entirely anew |
|
222 | - * with a new file, or to start building a new CSV file from |
|
223 | - * scratch. |
|
224 | - * |
|
225 | - * @return CSVHelper |
|
226 | - */ |
|
220 | + /** |
|
221 | + * Resets all internal data, allowing to start entirely anew |
|
222 | + * with a new file, or to start building a new CSV file from |
|
223 | + * scratch. |
|
224 | + * |
|
225 | + * @return CSVHelper |
|
226 | + */ |
|
227 | 227 | public function reset() |
228 | 228 | { |
229 | 229 | $this->data = array(); |
@@ -240,19 +240,19 @@ discard block |
||
240 | 240 | return $this->data; |
241 | 241 | } |
242 | 242 | |
243 | - /** |
|
244 | - * Retrieves the row at the specified index. |
|
245 | - * If there is no data at the index, this will |
|
246 | - * return an array populated with empty strings |
|
247 | - * for all available columns. |
|
248 | - * |
|
249 | - * Tip: Use the {@link rowExists()} method to check |
|
250 | - * whether the specified row exists. |
|
251 | - * |
|
252 | - * @param integer $index |
|
253 | - * @return array() |
|
254 | - * @see rowExists() |
|
255 | - */ |
|
243 | + /** |
|
244 | + * Retrieves the row at the specified index. |
|
245 | + * If there is no data at the index, this will |
|
246 | + * return an array populated with empty strings |
|
247 | + * for all available columns. |
|
248 | + * |
|
249 | + * Tip: Use the {@link rowExists()} method to check |
|
250 | + * whether the specified row exists. |
|
251 | + * |
|
252 | + * @param integer $index |
|
253 | + * @return array() |
|
254 | + * @see rowExists() |
|
255 | + */ |
|
256 | 256 | public function getRow($index) |
257 | 257 | { |
258 | 258 | if(isset($this->data[$index])) { |
@@ -262,63 +262,63 @@ discard block |
||
262 | 262 | return array_fill(0, $this->rowCount, ''); |
263 | 263 | } |
264 | 264 | |
265 | - /** |
|
266 | - * Checks whether the specified row exists in the data set. |
|
267 | - * @param integer $index |
|
268 | - * @return boolean |
|
269 | - */ |
|
265 | + /** |
|
266 | + * Checks whether the specified row exists in the data set. |
|
267 | + * @param integer $index |
|
268 | + * @return boolean |
|
269 | + */ |
|
270 | 270 | public function rowExists($index) |
271 | 271 | { |
272 | 272 | return isset($this->data[$index]); |
273 | 273 | } |
274 | 274 | |
275 | - /** |
|
276 | - * Counts the amount of rows in the parsed CSV, |
|
277 | - * excluding the headers if any, depending on |
|
278 | - * their position. |
|
279 | - * |
|
280 | - * @return integer |
|
281 | - */ |
|
275 | + /** |
|
276 | + * Counts the amount of rows in the parsed CSV, |
|
277 | + * excluding the headers if any, depending on |
|
278 | + * their position. |
|
279 | + * |
|
280 | + * @return integer |
|
281 | + */ |
|
282 | 282 | public function countRows() |
283 | 283 | { |
284 | 284 | return $this->rowCount; |
285 | 285 | } |
286 | 286 | |
287 | - /** |
|
288 | - * Counts the amount of rows in the parsed CSV, |
|
289 | - * excluding the headers if any, depending on |
|
290 | - * their position. |
|
291 | - * |
|
292 | - * @return integer |
|
293 | - */ |
|
287 | + /** |
|
288 | + * Counts the amount of rows in the parsed CSV, |
|
289 | + * excluding the headers if any, depending on |
|
290 | + * their position. |
|
291 | + * |
|
292 | + * @return integer |
|
293 | + */ |
|
294 | 294 | public function countColumns() |
295 | 295 | { |
296 | 296 | return $this->columnCount; |
297 | 297 | } |
298 | 298 | |
299 | - /** |
|
300 | - * Retrieves the headers, if any. Specify the position of the |
|
301 | - * headers first to ensure this works correctly. |
|
302 | - * |
|
303 | - * @return array Indexed array with header names. |
|
304 | - */ |
|
299 | + /** |
|
300 | + * Retrieves the headers, if any. Specify the position of the |
|
301 | + * headers first to ensure this works correctly. |
|
302 | + * |
|
303 | + * @return array Indexed array with header names. |
|
304 | + */ |
|
305 | 305 | public function getHeaders() |
306 | 306 | { |
307 | 307 | return $this->headers; |
308 | 308 | } |
309 | 309 | |
310 | - /** |
|
311 | - * Retrieves the column at the specified index. If there |
|
312 | - * is no column at the index, this returns an array |
|
313 | - * populated with empty strings. |
|
314 | - * |
|
315 | - * Tip: Use the {@link columnExists()} method to check |
|
316 | - * whether a column exists. |
|
317 | - * |
|
318 | - * @param integer $index |
|
319 | - * @return string[] |
|
320 | - * @see columnExists() |
|
321 | - */ |
|
310 | + /** |
|
311 | + * Retrieves the column at the specified index. If there |
|
312 | + * is no column at the index, this returns an array |
|
313 | + * populated with empty strings. |
|
314 | + * |
|
315 | + * Tip: Use the {@link columnExists()} method to check |
|
316 | + * whether a column exists. |
|
317 | + * |
|
318 | + * @param integer $index |
|
319 | + * @return string[] |
|
320 | + * @see columnExists() |
|
321 | + */ |
|
322 | 322 | public function getColumn($index) |
323 | 323 | { |
324 | 324 | $data = array(); |
@@ -334,11 +334,11 @@ discard block |
||
334 | 334 | return $data; |
335 | 335 | } |
336 | 336 | |
337 | - /** |
|
338 | - * Checks whether the specified column exists in the data set. |
|
339 | - * @param integer $index |
|
340 | - * @return boolean |
|
341 | - */ |
|
337 | + /** |
|
338 | + * Checks whether the specified column exists in the data set. |
|
339 | + * @param integer $index |
|
340 | + * @return boolean |
|
341 | + */ |
|
342 | 342 | public function columnExists($index) |
343 | 343 | { |
344 | 344 | if($index < $this->columnCount) { |
@@ -402,22 +402,22 @@ discard block |
||
402 | 402 | } |
403 | 403 | } |
404 | 404 | |
405 | - /** |
|
406 | - * Checks whether any errors have been encountered |
|
407 | - * while parsing the CSV. |
|
408 | - * |
|
409 | - * @return boolean |
|
410 | - * @see getErrorMessages() |
|
411 | - */ |
|
405 | + /** |
|
406 | + * Checks whether any errors have been encountered |
|
407 | + * while parsing the CSV. |
|
408 | + * |
|
409 | + * @return boolean |
|
410 | + * @see getErrorMessages() |
|
411 | + */ |
|
412 | 412 | public function hasErrors() |
413 | 413 | { |
414 | 414 | return !empty($this->errors); |
415 | 415 | } |
416 | 416 | |
417 | - /** |
|
418 | - * Retrieves all error messages. |
|
419 | - * @return array |
|
420 | - */ |
|
417 | + /** |
|
418 | + * Retrieves all error messages. |
|
419 | + * @return array |
|
420 | + */ |
|
421 | 421 | public function getErrorMessages() |
422 | 422 | { |
423 | 423 | return $this->errors; |
@@ -38,38 +38,38 @@ |
||
38 | 38 | */ |
39 | 39 | protected $text; |
40 | 40 | |
41 | - /** |
|
42 | - * @var string |
|
43 | - */ |
|
41 | + /** |
|
42 | + * @var string |
|
43 | + */ |
|
44 | 44 | protected $trimmed; |
45 | 45 | |
46 | - /** |
|
47 | - * @var int |
|
48 | - */ |
|
46 | + /** |
|
47 | + * @var int |
|
48 | + */ |
|
49 | 49 | protected $lineNumber; |
50 | 50 | |
51 | - /** |
|
52 | - * @var string |
|
53 | - */ |
|
51 | + /** |
|
52 | + * @var string |
|
53 | + */ |
|
54 | 54 | protected $type; |
55 | 55 | |
56 | - /** |
|
57 | - * @var string |
|
58 | - */ |
|
56 | + /** |
|
57 | + * @var string |
|
58 | + */ |
|
59 | 59 | protected $varName = ''; |
60 | 60 | |
61 | - /** |
|
62 | - * @var string |
|
63 | - */ |
|
61 | + /** |
|
62 | + * @var string |
|
63 | + */ |
|
64 | 64 | protected $varValue = ''; |
65 | 65 | |
66 | 66 | protected $valueUnquoted = ''; |
67 | 67 | |
68 | 68 | protected $quoteStyle = ''; |
69 | 69 | |
70 | - /** |
|
71 | - * @var string |
|
72 | - */ |
|
70 | + /** |
|
71 | + * @var string |
|
72 | + */ |
|
73 | 73 | protected $sectionName = ''; |
74 | 74 | |
75 | 75 | public function __construct(string $text, int $lineNumber) |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class IniHelper_Section |
23 | 23 | { |
24 | - /** |
|
25 | - * @var IniHelper |
|
26 | - */ |
|
24 | + /** |
|
25 | + * @var IniHelper |
|
26 | + */ |
|
27 | 27 | protected $ini; |
28 | 28 | |
29 | - /** |
|
30 | - * @var string |
|
31 | - */ |
|
29 | + /** |
|
30 | + * @var string |
|
31 | + */ |
|
32 | 32 | protected $name; |
33 | 33 | |
34 | - /** |
|
35 | - * @var IniHelper_Line[] |
|
36 | - */ |
|
34 | + /** |
|
35 | + * @var IniHelper_Line[] |
|
36 | + */ |
|
37 | 37 | protected $lines = array(); |
38 | 38 | |
39 | 39 | public function __construct(IniHelper $ini, string $name) |
@@ -42,33 +42,33 @@ discard block |
||
42 | 42 | $this->name = $name; |
43 | 43 | } |
44 | 44 | |
45 | - /** |
|
46 | - * The section's name. |
|
47 | - * @return string |
|
48 | - */ |
|
45 | + /** |
|
46 | + * The section's name. |
|
47 | + * @return string |
|
48 | + */ |
|
49 | 49 | public function getName() : string |
50 | 50 | { |
51 | 51 | return $this->name; |
52 | 52 | } |
53 | 53 | |
54 | - /** |
|
55 | - * Whether this is the default section: this |
|
56 | - * is used internally to store all variables that |
|
57 | - * are not in any specific section. |
|
58 | - * |
|
59 | - * @return bool |
|
60 | - */ |
|
54 | + /** |
|
55 | + * Whether this is the default section: this |
|
56 | + * is used internally to store all variables that |
|
57 | + * are not in any specific section. |
|
58 | + * |
|
59 | + * @return bool |
|
60 | + */ |
|
61 | 61 | public function isDefault() : bool |
62 | 62 | { |
63 | 63 | return $this->name === IniHelper::SECTION_DEFAULT; |
64 | 64 | } |
65 | 65 | |
66 | - /** |
|
67 | - * Adds a line instance to the section. |
|
68 | - * |
|
69 | - * @param IniHelper_Line $line |
|
70 | - * @return IniHelper_Section |
|
71 | - */ |
|
66 | + /** |
|
67 | + * Adds a line instance to the section. |
|
68 | + * |
|
69 | + * @param IniHelper_Line $line |
|
70 | + * @return IniHelper_Section |
|
71 | + */ |
|
72 | 72 | public function addLine(IniHelper_Line $line) : IniHelper_Section |
73 | 73 | { |
74 | 74 | $this->lines[] = $line; |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | return $this; |
77 | 77 | } |
78 | 78 | |
79 | - /** |
|
80 | - * Converts the values contained in the section into |
|
81 | - * an associative array. |
|
82 | - * |
|
83 | - * @return array |
|
84 | - */ |
|
79 | + /** |
|
80 | + * Converts the values contained in the section into |
|
81 | + * an associative array. |
|
82 | + * |
|
83 | + * @return array |
|
84 | + */ |
|
85 | 85 | public function toArray() : array |
86 | 86 | { |
87 | 87 | $result = array(); |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | return $result; |
115 | 115 | } |
116 | 116 | |
117 | - /** |
|
118 | - * Converts the section's lines into an INI string. |
|
119 | - * |
|
120 | - * @return string |
|
121 | - */ |
|
117 | + /** |
|
118 | + * Converts the section's lines into an INI string. |
|
119 | + * |
|
120 | + * @return string |
|
121 | + */ |
|
122 | 122 | public function toString() |
123 | 123 | { |
124 | 124 | $lines = array(); |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | return implode($this->ini->getEOLChar(), $lines); |
141 | 141 | } |
142 | 142 | |
143 | - /** |
|
144 | - * Deletes a line from the section. |
|
145 | - * |
|
146 | - * @param IniHelper_Line $toDelete |
|
147 | - * @return IniHelper_Section |
|
148 | - */ |
|
143 | + /** |
|
144 | + * Deletes a line from the section. |
|
145 | + * |
|
146 | + * @param IniHelper_Line $toDelete |
|
147 | + * @return IniHelper_Section |
|
148 | + */ |
|
149 | 149 | public function deleteLine(IniHelper_Line $toDelete) : IniHelper_Section |
150 | 150 | { |
151 | 151 | $keep = array(); |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | return $this; |
163 | 163 | } |
164 | 164 | |
165 | - /** |
|
166 | - * Sets the value of a variable, overwriting any existing value. |
|
167 | - * |
|
168 | - * @param string $name |
|
169 | - * @param mixed $value If an array is specified, it is treated as duplicate keys and will add a line for each value. |
|
170 | - * @return IniHelper_Section |
|
171 | - */ |
|
165 | + /** |
|
166 | + * Sets the value of a variable, overwriting any existing value. |
|
167 | + * |
|
168 | + * @param string $name |
|
169 | + * @param mixed $value If an array is specified, it is treated as duplicate keys and will add a line for each value. |
|
170 | + * @return IniHelper_Section |
|
171 | + */ |
|
172 | 172 | public function setValue(string $name, $value) : IniHelper_Section |
173 | 173 | { |
174 | 174 | $lines = $this->getLinesByVariable($name); |
@@ -229,15 +229,15 @@ discard block |
||
229 | 229 | return $this; |
230 | 230 | } |
231 | 231 | |
232 | - /** |
|
233 | - * Adds a variable value to the section. Unlike setValue(), this |
|
234 | - * will not overwrite any existing value. If the name is an existing |
|
235 | - * variable name, it will be converted to duplicate keys. |
|
236 | - * |
|
237 | - * @param string $name |
|
238 | - * @param mixed $value If this is an array, it will be treated as duplicate keys, and all values that are not present yet will be added. |
|
239 | - * @return IniHelper_Section |
|
240 | - */ |
|
232 | + /** |
|
233 | + * Adds a variable value to the section. Unlike setValue(), this |
|
234 | + * will not overwrite any existing value. If the name is an existing |
|
235 | + * variable name, it will be converted to duplicate keys. |
|
236 | + * |
|
237 | + * @param string $name |
|
238 | + * @param mixed $value If this is an array, it will be treated as duplicate keys, and all values that are not present yet will be added. |
|
239 | + * @return IniHelper_Section |
|
240 | + */ |
|
241 | 241 | public function addValue(string $name, $value) : IniHelper_Section |
242 | 242 | { |
243 | 243 | // array value? Treat it as duplicate keys. |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | |
298 | - /** |
|
299 | - * Retrieves all lines for the specified variable name. |
|
300 | - * |
|
301 | - * @param string $name |
|
302 | - * @return \AppUtils\IniHelper_Line[] |
|
303 | - */ |
|
298 | + /** |
|
299 | + * Retrieves all lines for the specified variable name. |
|
300 | + * |
|
301 | + * @param string $name |
|
302 | + * @return \AppUtils\IniHelper_Line[] |
|
303 | + */ |
|
304 | 304 | public function getLinesByVariable(string $name) |
305 | 305 | { |
306 | 306 | $result = array(); |