@@ -22,9 +22,9 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | class RequestHelper_Exception extends BaseException |
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * @var RequestHelper_Response|NULL |
|
| 27 | - */ |
|
| 25 | + /** |
|
| 26 | + * @var RequestHelper_Response|NULL |
|
| 27 | + */ |
|
| 28 | 28 | protected $response = null; |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -37,11 +37,11 @@ discard block |
||
| 37 | 37 | return $this; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Retrieves the related response instance, if available. |
|
| 42 | - * |
|
| 43 | - * @return RequestHelper_Response|NULL |
|
| 44 | - */ |
|
| 40 | + /** |
|
| 41 | + * Retrieves the related response instance, if available. |
|
| 42 | + * |
|
| 43 | + * @return RequestHelper_Response|NULL |
|
| 44 | + */ |
|
| 45 | 45 | public function getResponse() : ?RequestHelper_Response |
| 46 | 46 | { |
| 47 | 47 | return $this->response; |
@@ -40,19 +40,19 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | class NumberInfo |
| 42 | 42 | { |
| 43 | - /** |
|
| 44 | - * @var string|int|float|null |
|
| 45 | - */ |
|
| 43 | + /** |
|
| 44 | + * @var string|int|float|null |
|
| 45 | + */ |
|
| 46 | 46 | protected $rawValue; |
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @var array<string,mixed> |
|
| 50 | - */ |
|
| 48 | + /** |
|
| 49 | + * @var array<string,mixed> |
|
| 50 | + */ |
|
| 51 | 51 | protected $info; |
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @var bool |
|
| 55 | - */ |
|
| 53 | + /** |
|
| 54 | + * @var bool |
|
| 55 | + */ |
|
| 56 | 56 | protected $empty = false; |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * Units and whether they allow decimal values. |
| 65 | - * @var array<string,bool> |
|
| 66 | - */ |
|
| 65 | + * @var array<string,bool> |
|
| 66 | + */ |
|
| 67 | 67 | protected $knownUnits = array( |
| 68 | 68 | '%' => true, |
| 69 | 69 | 'rem' => true, |
@@ -141,21 +141,21 @@ discard block |
||
| 141 | 141 | return $this; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Retrieves the raw, internal information array resulting |
|
| 146 | - * from the parsing of the number. |
|
| 147 | - * |
|
| 148 | - * @return array<string,mixed> |
|
| 149 | - */ |
|
| 144 | + /** |
|
| 145 | + * Retrieves the raw, internal information array resulting |
|
| 146 | + * from the parsing of the number. |
|
| 147 | + * |
|
| 148 | + * @return array<string,mixed> |
|
| 149 | + */ |
|
| 150 | 150 | public function getRawInfo() : array |
| 151 | 151 | { |
| 152 | 152 | return $this->info; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * Whether the number was empty (null or empty string). |
|
| 157 | - * @return boolean |
|
| 158 | - */ |
|
| 155 | + /** |
|
| 156 | + * Whether the number was empty (null or empty string). |
|
| 157 | + * @return boolean |
|
| 158 | + */ |
|
| 159 | 159 | public function isEmpty() : bool |
| 160 | 160 | { |
| 161 | 161 | return $this->empty; |
@@ -729,12 +729,12 @@ discard block |
||
| 729 | 729 | return $cache[$key]; |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | - /** |
|
| 733 | - * Parses a string number notation with units included, e.g. 14px, 50%... |
|
| 734 | - * |
|
| 735 | - * @param string $test |
|
| 736 | - * @return array<string,mixed> |
|
| 737 | - */ |
|
| 732 | + /** |
|
| 733 | + * Parses a string number notation with units included, e.g. 14px, 50%... |
|
| 734 | + * |
|
| 735 | + * @param string $test |
|
| 736 | + * @return array<string,mixed> |
|
| 737 | + */ |
|
| 738 | 738 | private function parseStringValue(string $test) : array |
| 739 | 739 | { |
| 740 | 740 | $number = null; |
@@ -785,13 +785,13 @@ discard block |
||
| 785 | 785 | return $this->filterInfo($result); |
| 786 | 786 | } |
| 787 | 787 | |
| 788 | - /** |
|
| 789 | - * Attempts to determine what kind of units are specified |
|
| 790 | - * in the string. Returns NULL if none could be matched. |
|
| 791 | - * |
|
| 792 | - * @param string $value |
|
| 793 | - * @return array<string,mixed>|NULL |
|
| 794 | - */ |
|
| 788 | + /** |
|
| 789 | + * Attempts to determine what kind of units are specified |
|
| 790 | + * in the string. Returns NULL if none could be matched. |
|
| 791 | + * |
|
| 792 | + * @param string $value |
|
| 793 | + * @return array<string,mixed>|NULL |
|
| 794 | + */ |
|
| 795 | 795 | private function findUnits(string $value) : ?array |
| 796 | 796 | { |
| 797 | 797 | $vlength = strlen($value); |
@@ -819,12 +819,12 @@ discard block |
||
| 819 | 819 | return null; |
| 820 | 820 | } |
| 821 | 821 | |
| 822 | - /** |
|
| 823 | - * Creates the cache key for the specified value. |
|
| 824 | - * |
|
| 825 | - * @param mixed $value |
|
| 826 | - * @return string |
|
| 827 | - */ |
|
| 822 | + /** |
|
| 823 | + * Creates the cache key for the specified value. |
|
| 824 | + * |
|
| 825 | + * @param mixed $value |
|
| 826 | + * @return string |
|
| 827 | + */ |
|
| 828 | 828 | private function createValueKey($value) : string |
| 829 | 829 | { |
| 830 | 830 | if(!is_string($value) && !is_numeric($value)) |
@@ -835,59 +835,59 @@ discard block |
||
| 835 | 835 | return (string)$value; |
| 836 | 836 | } |
| 837 | 837 | |
| 838 | - /** |
|
| 839 | - * Called if explicitly enabled: allows filtering the |
|
| 840 | - * number after the detection process has completed. |
|
| 841 | - * |
|
| 842 | - * @param string|NULL $number The adjusted number |
|
| 843 | - * @param string $originalString The original value before it was parsed |
|
| 844 | - * @return string|null |
|
| 845 | - */ |
|
| 838 | + /** |
|
| 839 | + * Called if explicitly enabled: allows filtering the |
|
| 840 | + * number after the detection process has completed. |
|
| 841 | + * |
|
| 842 | + * @param string|NULL $number The adjusted number |
|
| 843 | + * @param string $originalString The original value before it was parsed |
|
| 844 | + * @return string|null |
|
| 845 | + */ |
|
| 846 | 846 | protected function postProcess(?string $number, /** @scrutinizer ignore-unused */ string $originalString) |
| 847 | 847 | { |
| 848 | 848 | return $number; |
| 849 | 849 | } |
| 850 | 850 | |
| 851 | - /** |
|
| 852 | - * Filters the value before it is parsed, but only if it is a string. |
|
| 853 | - * |
|
| 854 | - * NOTE: This may be overwritten in a subclass, to allow custom filtering |
|
| 855 | - * the values. An example of a use case would be a preprocessor for |
|
| 856 | - * variables in a templating system. |
|
| 857 | - * |
|
| 858 | - * @param string $trimmedString The trimmed value. |
|
| 859 | - * @param array<string,mixed> $cache The internal values cache array. |
|
| 860 | - * @param string $originalValue The original value that the NumberInfo was created for. |
|
| 861 | - * @return string |
|
| 862 | - * |
|
| 863 | - * @see NumberInfo::enablePostProcess() |
|
| 864 | - */ |
|
| 851 | + /** |
|
| 852 | + * Filters the value before it is parsed, but only if it is a string. |
|
| 853 | + * |
|
| 854 | + * NOTE: This may be overwritten in a subclass, to allow custom filtering |
|
| 855 | + * the values. An example of a use case would be a preprocessor for |
|
| 856 | + * variables in a templating system. |
|
| 857 | + * |
|
| 858 | + * @param string $trimmedString The trimmed value. |
|
| 859 | + * @param array<string,mixed> $cache The internal values cache array. |
|
| 860 | + * @param string $originalValue The original value that the NumberInfo was created for. |
|
| 861 | + * @return string |
|
| 862 | + * |
|
| 863 | + * @see NumberInfo::enablePostProcess() |
|
| 864 | + */ |
|
| 865 | 865 | protected function preProcess(string $trimmedString, /** @scrutinizer ignore-unused */ array &$cache, /** @scrutinizer ignore-unused */ string $originalValue) : string |
| 866 | 866 | { |
| 867 | 867 | return str_replace(',', '.', $trimmedString); |
| 868 | 868 | } |
| 869 | 869 | |
| 870 | - /** |
|
| 871 | - * Enables the post-processing so the postProcess method gets called. |
|
| 872 | - * This should be called in the {@link NumberInfo::preProcess()} |
|
| 873 | - * method as needed. |
|
| 874 | - * |
|
| 875 | - * @return $this |
|
| 876 | - * @see NumberInfo::postProcess() |
|
| 877 | - */ |
|
| 870 | + /** |
|
| 871 | + * Enables the post-processing so the postProcess method gets called. |
|
| 872 | + * This should be called in the {@link NumberInfo::preProcess()} |
|
| 873 | + * method as needed. |
|
| 874 | + * |
|
| 875 | + * @return $this |
|
| 876 | + * @see NumberInfo::postProcess() |
|
| 877 | + */ |
|
| 878 | 878 | protected function enablePostProcess() : NumberInfo |
| 879 | 879 | { |
| 880 | 880 | $this->postProcess = true; |
| 881 | 881 | return $this; |
| 882 | 882 | } |
| 883 | 883 | |
| 884 | - /** |
|
| 885 | - * Filters the number info array to adjust the units |
|
| 886 | - * and number according to the required rules. |
|
| 887 | - * |
|
| 888 | - * @param array<string,mixed> $info |
|
| 889 | - * @return array<string,mixed> |
|
| 890 | - */ |
|
| 884 | + /** |
|
| 885 | + * Filters the number info array to adjust the units |
|
| 886 | + * and number according to the required rules. |
|
| 887 | + * |
|
| 888 | + * @param array<string,mixed> $info |
|
| 889 | + * @return array<string,mixed> |
|
| 890 | + */ |
|
| 891 | 891 | protected function filterInfo(array $info) : array |
| 892 | 892 | { |
| 893 | 893 | $useUnits = 'px'; |
@@ -41,71 +41,71 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | class Highlighter |
| 43 | 43 | { |
| 44 | - /** |
|
| 45 | - * Creates a new GeSHi instance from a source code string. |
|
| 46 | - * |
|
| 47 | - * @param string $sourceCode |
|
| 48 | - * @param string $format |
|
| 49 | - * @return GeSHi |
|
| 50 | - */ |
|
| 44 | + /** |
|
| 45 | + * Creates a new GeSHi instance from a source code string. |
|
| 46 | + * |
|
| 47 | + * @param string $sourceCode |
|
| 48 | + * @param string $format |
|
| 49 | + * @return GeSHi |
|
| 50 | + */ |
|
| 51 | 51 | public static function fromString(string $sourceCode, string $format) : GeSHi |
| 52 | 52 | { |
| 53 | 53 | return new GeSHi($sourceCode, $format); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Creates a new GeSHi instance from the contents of a file. |
|
| 58 | - * |
|
| 59 | - * @param string $path |
|
| 60 | - * @param string $format |
|
| 61 | - * @return GeSHi |
|
| 62 | - */ |
|
| 56 | + /** |
|
| 57 | + * Creates a new GeSHi instance from the contents of a file. |
|
| 58 | + * |
|
| 59 | + * @param string $path |
|
| 60 | + * @param string $format |
|
| 61 | + * @return GeSHi |
|
| 62 | + */ |
|
| 63 | 63 | public static function fromFile(string $path, string $format) : GeSHi |
| 64 | 64 | { |
| 65 | 65 | return self::fromString(FileHelper::readContents($path), $format); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Parses and highlights the target string. |
|
| 70 | - * |
|
| 71 | - * @param string $sourceCode |
|
| 72 | - * @param string $format |
|
| 73 | - * @return string |
|
| 74 | - */ |
|
| 68 | + /** |
|
| 69 | + * Parses and highlights the target string. |
|
| 70 | + * |
|
| 71 | + * @param string $sourceCode |
|
| 72 | + * @param string $format |
|
| 73 | + * @return string |
|
| 74 | + */ |
|
| 75 | 75 | public static function parseString(string $sourceCode, string $format) : string |
| 76 | 76 | { |
| 77 | 77 | return self::fromString($sourceCode, $format)->parse_code(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Parses and highlights the contents of the target file. |
|
| 82 | - * |
|
| 83 | - * @param string $path |
|
| 84 | - * @param string $format |
|
| 85 | - * @return string |
|
| 86 | - */ |
|
| 80 | + /** |
|
| 81 | + * Parses and highlights the contents of the target file. |
|
| 82 | + * |
|
| 83 | + * @param string $path |
|
| 84 | + * @param string $format |
|
| 85 | + * @return string |
|
| 86 | + */ |
|
| 87 | 87 | public static function parseFile(string $path, string $format) : string |
| 88 | 88 | { |
| 89 | 89 | return self::fromFile($path, $format)->parse_code(); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Adds HTML syntax highlighting to the specified SQL string. |
|
| 94 | - * |
|
| 95 | - * @param string $sql |
|
| 96 | - * @return string |
|
| 97 | - */ |
|
| 92 | + /** |
|
| 93 | + * Adds HTML syntax highlighting to the specified SQL string. |
|
| 94 | + * |
|
| 95 | + * @param string $sql |
|
| 96 | + * @return string |
|
| 97 | + */ |
|
| 98 | 98 | public static function sql(string $sql) : string |
| 99 | 99 | { |
| 100 | 100 | return self::parseString($sql, 'sql'); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - /** |
|
| 104 | - * Adds HTML syntax highlighting to a JSON string, or a data array/object. |
|
| 105 | - * |
|
| 106 | - * @param array<int|string,mixed>|object|string $subject A JSON string, or data array/object to convert to JSON to highlight. |
|
| 107 | - * @return string |
|
| 108 | - */ |
|
| 103 | + /** |
|
| 104 | + * Adds HTML syntax highlighting to a JSON string, or a data array/object. |
|
| 105 | + * |
|
| 106 | + * @param array<int|string,mixed>|object|string $subject A JSON string, or data array/object to convert to JSON to highlight. |
|
| 107 | + * @return string |
|
| 108 | + */ |
|
| 109 | 109 | public static function json($subject) : string |
| 110 | 110 | { |
| 111 | 111 | if(!is_string($subject)) |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | return self::parseString($subject, 'javascript'); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * Adds HTML syntax highlighting to the specified XML code. |
|
| 123 | - * |
|
| 124 | - * @param string $xml The XML to highlight. |
|
| 125 | - * @param bool $formatSource Whether to format the source with indentation to make it readable. |
|
| 126 | - * @return string |
|
| 127 | - */ |
|
| 121 | + /** |
|
| 122 | + * Adds HTML syntax highlighting to the specified XML code. |
|
| 123 | + * |
|
| 124 | + * @param string $xml The XML to highlight. |
|
| 125 | + * @param bool $formatSource Whether to format the source with indentation to make it readable. |
|
| 126 | + * @return string |
|
| 127 | + */ |
|
| 128 | 128 | public static function xml(string $xml, bool $formatSource=false) : string |
| 129 | 129 | { |
| 130 | 130 | if($formatSource) |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | return self::parseString($xml, 'xml'); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Adds HTML syntax highlighting to the specified HTML code. |
|
| 146 | - * |
|
| 147 | - * @param string $html |
|
| 148 | - * @param bool $formatSource |
|
| 149 | - * @return string |
|
| 150 | - */ |
|
| 144 | + /** |
|
| 145 | + * Adds HTML syntax highlighting to the specified HTML code. |
|
| 146 | + * |
|
| 147 | + * @param string $html |
|
| 148 | + * @param bool $formatSource |
|
| 149 | + * @return string |
|
| 150 | + */ |
|
| 151 | 151 | public static function html(string $html, bool $formatSource=false) : string |
| 152 | 152 | { |
| 153 | 153 | if($formatSource) |
@@ -164,27 +164,27 @@ discard block |
||
| 164 | 164 | return self::parseString($html, 'xml'); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - /** |
|
| 168 | - * Adds HTML syntax highlighting to a bit of PHP code. |
|
| 169 | - * |
|
| 170 | - * @param string $phpCode |
|
| 171 | - * @return string |
|
| 172 | - */ |
|
| 167 | + /** |
|
| 168 | + * Adds HTML syntax highlighting to a bit of PHP code. |
|
| 169 | + * |
|
| 170 | + * @param string $phpCode |
|
| 171 | + * @return string |
|
| 172 | + */ |
|
| 173 | 173 | public static function php(string $phpCode) : string |
| 174 | 174 | { |
| 175 | 175 | return self::parseString($phpCode, 'php'); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - /** |
|
| 179 | - * Adds HTML syntax highlighting to an URL. |
|
| 180 | - * |
|
| 181 | - * NOTE: Includes the necessary CSS styles. When |
|
| 182 | - * highlighting several URLs in the same page, |
|
| 183 | - * prefer using the `parseURL` function instead. |
|
| 184 | - * |
|
| 185 | - * @param string $url |
|
| 186 | - * @return string |
|
| 187 | - */ |
|
| 178 | + /** |
|
| 179 | + * Adds HTML syntax highlighting to an URL. |
|
| 180 | + * |
|
| 181 | + * NOTE: Includes the necessary CSS styles. When |
|
| 182 | + * highlighting several URLs in the same page, |
|
| 183 | + * prefer using the `parseURL` function instead. |
|
| 184 | + * |
|
| 185 | + * @param string $url |
|
| 186 | + * @return string |
|
| 187 | + */ |
|
| 188 | 188 | public static function url(string $url) : string |
| 189 | 189 | { |
| 190 | 190 | $info = parseURL($url); |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | class OperationResult_Collection extends OperationResult |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * @var OperationResult[] |
|
| 31 | - */ |
|
| 29 | + /** |
|
| 30 | + * @var OperationResult[] |
|
| 31 | + */ |
|
| 32 | 32 | protected $results = array(); |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -123,9 +123,9 @@ discard block |
||
| 123 | 123 | return $this; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - /** |
|
| 127 | - * @return OperationResult[] |
|
| 128 | - */ |
|
| 126 | + /** |
|
| 127 | + * @return OperationResult[] |
|
| 128 | + */ |
|
| 129 | 129 | public function getResults() : array |
| 130 | 130 | { |
| 131 | 131 | return $this->results; |
@@ -22,19 +22,19 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | public const ERROR_NO_BOUNDARIES_SPECIFIED = 44401; |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @var RequestHelper |
|
| 27 | - */ |
|
| 25 | + /** |
|
| 26 | + * @var RequestHelper |
|
| 27 | + */ |
|
| 28 | 28 | protected $helper; |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @var RequestHelper_Boundaries_Boundary[] |
|
| 32 | - */ |
|
| 30 | + /** |
|
| 31 | + * @var RequestHelper_Boundaries_Boundary[] |
|
| 32 | + */ |
|
| 33 | 33 | protected $boundaries = array(); |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var integer |
|
| 37 | - */ |
|
| 35 | + /** |
|
| 36 | + * @var integer |
|
| 37 | + */ |
|
| 38 | 38 | protected $contentLength = 0; |
| 39 | 39 | |
| 40 | 40 | public function __construct(RequestHelper $helper) |
@@ -42,31 +42,31 @@ discard block |
||
| 42 | 42 | $this->helper = $helper; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Retrieves the string that is used to separate mime boundaries in the body. |
|
| 47 | - * |
|
| 48 | - * @return string |
|
| 49 | - */ |
|
| 45 | + /** |
|
| 46 | + * Retrieves the string that is used to separate mime boundaries in the body. |
|
| 47 | + * |
|
| 48 | + * @return string |
|
| 49 | + */ |
|
| 50 | 50 | public function getMimeBoundary() : string |
| 51 | 51 | { |
| 52 | 52 | return $this->helper->getMimeBoundary(); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Retrieves the end of line character(s) used in the body. |
|
| 57 | - * |
|
| 58 | - * @return string |
|
| 59 | - */ |
|
| 55 | + /** |
|
| 56 | + * Retrieves the end of line character(s) used in the body. |
|
| 57 | + * |
|
| 58 | + * @return string |
|
| 59 | + */ |
|
| 60 | 60 | public function getEOL() : string |
| 61 | 61 | { |
| 62 | 62 | return $this->helper->getEOL(); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Retrieves the total content length of all boundary contents. |
|
| 67 | - * |
|
| 68 | - * @return int |
|
| 69 | - */ |
|
| 65 | + /** |
|
| 66 | + * Retrieves the total content length of all boundary contents. |
|
| 67 | + * |
|
| 68 | + * @return int |
|
| 69 | + */ |
|
| 70 | 70 | public function getContentLength() : int |
| 71 | 71 | { |
| 72 | 72 | // this must use strlen, and not mb_strlen: the content length |
@@ -75,15 +75,15 @@ discard block |
||
| 75 | 75 | return strlen($this->render()); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Adds a file to be sent with the request. |
|
| 80 | - * |
|
| 81 | - * @param string $varName The variable name to send the file in |
|
| 82 | - * @param string $fileName The name of the file as it should be received at the destination |
|
| 83 | - * @param string $content The raw content of the file |
|
| 84 | - * @param string $contentType The content type, use the constants to specify this |
|
| 85 | - * @param string $encoding The encoding of the file, use the constants to specify this |
|
| 86 | - */ |
|
| 78 | + /** |
|
| 79 | + * Adds a file to be sent with the request. |
|
| 80 | + * |
|
| 81 | + * @param string $varName The variable name to send the file in |
|
| 82 | + * @param string $fileName The name of the file as it should be received at the destination |
|
| 83 | + * @param string $content The raw content of the file |
|
| 84 | + * @param string $contentType The content type, use the constants to specify this |
|
| 85 | + * @param string $encoding The encoding of the file, use the constants to specify this |
|
| 86 | + */ |
|
| 87 | 87 | public function addFile(string $varName, string $fileName, string $content, string $contentType = '', string $encoding = '') : RequestHelper_Boundaries |
| 88 | 88 | { |
| 89 | 89 | if(empty($contentType)) |
@@ -107,13 +107,13 @@ discard block |
||
| 107 | 107 | return $this->addBoundary($boundary); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - /** |
|
| 111 | - * Adds arbitrary content. |
|
| 112 | - * |
|
| 113 | - * @param string $varName |
|
| 114 | - * @param string $content |
|
| 115 | - * @param string $contentType |
|
| 116 | - */ |
|
| 110 | + /** |
|
| 111 | + * Adds arbitrary content. |
|
| 112 | + * |
|
| 113 | + * @param string $varName |
|
| 114 | + * @param string $content |
|
| 115 | + * @param string $contentType |
|
| 116 | + */ |
|
| 117 | 117 | public function addContent(string $varName, string $content, string $contentType) : RequestHelper_Boundaries |
| 118 | 118 | { |
| 119 | 119 | $content = ConvertHelper::string2utf8($content); |
@@ -127,13 +127,13 @@ discard block |
||
| 127 | 127 | return $this->addBoundary($boundary); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - /** |
|
| 131 | - * Adds a variable to be sent with the request. If it |
|
| 132 | - * already exists, its value is overwritten. |
|
| 133 | - * |
|
| 134 | - * @param string $name |
|
| 135 | - * @param string $value |
|
| 136 | - */ |
|
| 130 | + /** |
|
| 131 | + * Adds a variable to be sent with the request. If it |
|
| 132 | + * already exists, its value is overwritten. |
|
| 133 | + * |
|
| 134 | + * @param string $name |
|
| 135 | + * @param string $value |
|
| 136 | + */ |
|
| 137 | 137 | public function addVariable(string $name, string $value) : RequestHelper_Boundaries |
| 138 | 138 | { |
| 139 | 139 | $boundary = $this->createBoundary($value) |
@@ -149,11 +149,11 @@ discard block |
||
| 149 | 149 | return $this; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - /** |
|
| 153 | - * Renders the response body with all mime boundaries. |
|
| 154 | - * |
|
| 155 | - * @return string |
|
| 156 | - */ |
|
| 152 | + /** |
|
| 153 | + * Renders the response body with all mime boundaries. |
|
| 154 | + * |
|
| 155 | + * @return string |
|
| 156 | + */ |
|
| 157 | 157 | public function render() : string |
| 158 | 158 | { |
| 159 | 159 | if(empty($this->boundaries)) |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public const STATUS_FILETYPE_CHANGE = 'filetype-change'; |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var array |
|
| 29 | - * @see http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.status.html |
|
| 30 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var array |
|
| 29 | + * @see http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.status.html |
|
| 30 | + */ |
|
| 31 | 31 | protected static $knownStati = array( |
| 32 | 32 | 'a' => self::STATUS_ADD, |
| 33 | 33 | 'd' => self::STATUS_DELETE, |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | '~' => self::STATUS_FILETYPE_CHANGE, |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * @var string |
|
| 45 | - */ |
|
| 43 | + /** |
|
| 44 | + * @var string |
|
| 45 | + */ |
|
| 46 | 46 | protected $status; |
| 47 | 47 | |
| 48 | 48 | protected function _execute() |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $svnStatusCode = strtolower(substr($lines[0], 0, 1)); |
| 67 | 67 | if(isset(self::$knownStati[$svnStatusCode])) { |
| 68 | - $this->status = self::$knownStati[$svnStatusCode]; |
|
| 68 | + $this->status = self::$knownStati[$svnStatusCode]; |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -21,18 +21,18 @@ discard block |
||
| 21 | 21 | public const SVN_ERROR_TYPE_WARNING = 'warning'; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * @var SVNHelper |
|
| 25 | - */ |
|
| 24 | + * @var SVNHelper |
|
| 25 | + */ |
|
| 26 | 26 | protected $helper; |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @var SVNHelper_Target |
|
| 30 | - */ |
|
| 28 | + /** |
|
| 29 | + * @var SVNHelper_Target |
|
| 30 | + */ |
|
| 31 | 31 | protected $target; |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @var SVNHelper_CommandResult |
|
| 35 | - */ |
|
| 33 | + /** |
|
| 34 | + * @var SVNHelper_CommandResult |
|
| 35 | + */ |
|
| 36 | 36 | protected $result; |
| 37 | 37 | |
| 38 | 38 | public function __construct(SVNHelper $helper, SVNHelper_Target $target) |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | $this->target = $target; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @return SVNHelper |
|
| 46 | - */ |
|
| 44 | + /** |
|
| 45 | + * @return SVNHelper |
|
| 46 | + */ |
|
| 47 | 47 | public function getSVN() |
| 48 | 48 | { |
| 49 | 49 | return $this->helper; |
@@ -99,15 +99,15 @@ discard block |
||
| 99 | 99 | return $cmd; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * Executes the specified command, and returns a result |
|
| 104 | - * instance to read the results. |
|
| 105 | - * |
|
| 106 | - * @param string $mode The command mode, e.g. commit / update... |
|
| 107 | - * @param string $path The path to apply the command to |
|
| 108 | - * @param array $params |
|
| 109 | - * @return SVNHelper_CommandResult |
|
| 110 | - */ |
|
| 102 | + /** |
|
| 103 | + * Executes the specified command, and returns a result |
|
| 104 | + * instance to read the results. |
|
| 105 | + * |
|
| 106 | + * @param string $mode The command mode, e.g. commit / update... |
|
| 107 | + * @param string $path The path to apply the command to |
|
| 108 | + * @param array $params |
|
| 109 | + * @return SVNHelper_CommandResult |
|
| 110 | + */ |
|
| 111 | 111 | protected function execCommand($mode, $path=null, $params=array()) |
| 112 | 112 | { |
| 113 | 113 | $relative = $this->helper->relativizePath($path); |
@@ -194,10 +194,10 @@ discard block |
||
| 194 | 194 | return $this->result; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - /** |
|
| 198 | - * Retrieves the type of command, e.g. "Commit" |
|
| 199 | - * @return string |
|
| 200 | - */ |
|
| 197 | + /** |
|
| 198 | + * Retrieves the type of command, e.g. "Commit" |
|
| 199 | + * @return string |
|
| 200 | + */ |
|
| 201 | 201 | public function getType() |
| 202 | 202 | { |
| 203 | 203 | return str_replace('SVNHelper_Command_', '', get_class($this)); |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | 'WriteThreshold' => 100 |
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @var string |
|
| 43 | - */ |
|
| 41 | + /** |
|
| 42 | + * @var string |
|
| 43 | + */ |
|
| 44 | 44 | protected $file; |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * @var ZipArchive|NULL |
|
| 48 | - */ |
|
| 46 | + /** |
|
| 47 | + * @var ZipArchive|NULL |
|
| 48 | + */ |
|
| 49 | 49 | protected $zip; |
| 50 | 50 | |
| 51 | 51 | public function __construct(string $targetFile) |
@@ -53,35 +53,35 @@ discard block |
||
| 53 | 53 | $this->file = $targetFile; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Sets an option, among the available options: |
|
| 58 | - * |
|
| 59 | - * <ul> |
|
| 60 | - * <li>WriteThreshold: The amount of files to add before the zip is automatically written to disk and re-opened to release the file handles. Set to 0 to disable.</li> |
|
| 61 | - * </ul> |
|
| 62 | - * |
|
| 63 | - * @param string $name |
|
| 64 | - * @param mixed $value |
|
| 65 | - * @return ZIPHelper |
|
| 66 | - */ |
|
| 56 | + /** |
|
| 57 | + * Sets an option, among the available options: |
|
| 58 | + * |
|
| 59 | + * <ul> |
|
| 60 | + * <li>WriteThreshold: The amount of files to add before the zip is automatically written to disk and re-opened to release the file handles. Set to 0 to disable.</li> |
|
| 61 | + * </ul> |
|
| 62 | + * |
|
| 63 | + * @param string $name |
|
| 64 | + * @param mixed $value |
|
| 65 | + * @return ZIPHelper |
|
| 66 | + */ |
|
| 67 | 67 | public function setOption(string $name, $value) : ZIPHelper |
| 68 | 68 | { |
| 69 | 69 | $this->options[$name] = $value; |
| 70 | 70 | return $this; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Adds a file to the zip. By default, the file is stored |
|
| 75 | - * with the same name in the root of the zip. Use the optional |
|
| 76 | - * parameter to change the location in the zip. |
|
| 77 | - * |
|
| 78 | - * @param string $filePath |
|
| 79 | - * @param string|null $zipPath If no path is specified, file will be added with the same name in the ZIP's root. |
|
| 80 | - * @throws ZIPHelper_Exception |
|
| 81 | - * @return bool |
|
| 82 | - * |
|
| 83 | - * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST |
|
| 84 | - */ |
|
| 73 | + /** |
|
| 74 | + * Adds a file to the zip. By default, the file is stored |
|
| 75 | + * with the same name in the root of the zip. Use the optional |
|
| 76 | + * parameter to change the location in the zip. |
|
| 77 | + * |
|
| 78 | + * @param string $filePath |
|
| 79 | + * @param string|null $zipPath If no path is specified, file will be added with the same name in the ZIP's root. |
|
| 80 | + * @throws ZIPHelper_Exception |
|
| 81 | + * @return bool |
|
| 82 | + * |
|
| 83 | + * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST |
|
| 84 | + */ |
|
| 85 | 85 | public function addFile(string $filePath, ?string $zipPath=null) : bool |
| 86 | 86 | { |
| 87 | 87 | $this->open(); |
@@ -289,14 +289,14 @@ discard block |
||
| 289 | 289 | return $this; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - /** |
|
| 293 | - * Extracts all files and folders from the zip to the |
|
| 294 | - * target folder. If no folder is specified, the files |
|
| 295 | - * are extracted into the same folder as the zip itself. |
|
| 296 | - * |
|
| 297 | - * @param string|NULL $outputFolder If no folder is specified, uses the target file's folder. |
|
| 298 | - * @return boolean |
|
| 299 | - */ |
|
| 292 | + /** |
|
| 293 | + * Extracts all files and folders from the zip to the |
|
| 294 | + * target folder. If no folder is specified, the files |
|
| 295 | + * are extracted into the same folder as the zip itself. |
|
| 296 | + * |
|
| 297 | + * @param string|NULL $outputFolder If no folder is specified, uses the target file's folder. |
|
| 298 | + * @return boolean |
|
| 299 | + */ |
|
| 300 | 300 | public function extractAll(?string $outputFolder=null) : bool |
| 301 | 301 | { |
| 302 | 302 | if(empty($outputFolder)) { |
@@ -308,9 +308,9 @@ discard block |
||
| 308 | 308 | return $this->zip->extractTo($outputFolder); |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - /** |
|
| 312 | - * @return ZipArchive |
|
| 313 | - */ |
|
| 311 | + /** |
|
| 312 | + * @return ZipArchive |
|
| 313 | + */ |
|
| 314 | 314 | public function getArchive() : ZipArchive |
| 315 | 315 | { |
| 316 | 316 | $this->open(); |
@@ -318,14 +318,14 @@ discard block |
||
| 318 | 318 | return $this->zip; |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - /** |
|
| 322 | - * JSON encodes the specified data and adds the json as |
|
| 323 | - * a file in the ZIP archive. |
|
| 324 | - * |
|
| 325 | - * @param mixed $data |
|
| 326 | - * @param string $zipPath |
|
| 327 | - * @return boolean |
|
| 328 | - */ |
|
| 321 | + /** |
|
| 322 | + * JSON encodes the specified data and adds the json as |
|
| 323 | + * a file in the ZIP archive. |
|
| 324 | + * |
|
| 325 | + * @param mixed $data |
|
| 326 | + * @param string $zipPath |
|
| 327 | + * @return boolean |
|
| 328 | + */ |
|
| 329 | 329 | public function addJSON($data, string $zipPath) : bool |
| 330 | 330 | { |
| 331 | 331 | return $this->addString( |
@@ -32,62 +32,62 @@ discard block |
||
| 32 | 32 | public const ERROR_CURL_INIT_FAILED = 17903; |
| 33 | 33 | public const ERROR_CANNOT_OPEN_LOGFILE = 17904; |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var string |
|
| 37 | - */ |
|
| 35 | + /** |
|
| 36 | + * @var string |
|
| 37 | + */ |
|
| 38 | 38 | protected $eol = "\r\n"; |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var string |
|
| 42 | - */ |
|
| 40 | + /** |
|
| 41 | + * @var string |
|
| 42 | + */ |
|
| 43 | 43 | protected $mimeBoundary; |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @var string |
|
| 47 | - */ |
|
| 45 | + /** |
|
| 46 | + * @var string |
|
| 47 | + */ |
|
| 48 | 48 | protected $destination; |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @var array<string,string> |
|
| 52 | - */ |
|
| 50 | + /** |
|
| 51 | + * @var array<string,string> |
|
| 52 | + */ |
|
| 53 | 53 | protected $headers = array(); |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Whether to verify SSL certificates. |
|
| 57 | - * @var bool |
|
| 58 | - */ |
|
| 55 | + /** |
|
| 56 | + * Whether to verify SSL certificates. |
|
| 57 | + * @var bool |
|
| 58 | + */ |
|
| 59 | 59 | protected $verifySSL = true; |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @var RequestHelper_Boundaries |
|
| 63 | - */ |
|
| 61 | + /** |
|
| 62 | + * @var RequestHelper_Boundaries |
|
| 63 | + */ |
|
| 64 | 64 | protected $boundaries; |
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * @var RequestHelper_Response|NULL |
|
| 68 | - */ |
|
| 66 | + /** |
|
| 67 | + * @var RequestHelper_Response|NULL |
|
| 68 | + */ |
|
| 69 | 69 | protected $response; |
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Timeout duration, in seconds. |
|
| 73 | - * @var integer |
|
| 74 | - */ |
|
| 71 | + /** |
|
| 72 | + * Timeout duration, in seconds. |
|
| 73 | + * @var integer |
|
| 74 | + */ |
|
| 75 | 75 | protected $timeout = 30; |
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * @var string |
|
| 79 | - */ |
|
| 77 | + /** |
|
| 78 | + * @var string |
|
| 79 | + */ |
|
| 80 | 80 | protected $logfile = ''; |
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * @var resource|NULL |
|
| 84 | - */ |
|
| 82 | + /** |
|
| 83 | + * @var resource|NULL |
|
| 84 | + */ |
|
| 85 | 85 | protected $logfilePointer = null; |
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Creates a new request helper to send POST data to the specified destination URL. |
|
| 89 | - * @param string $destinationURL |
|
| 90 | - */ |
|
| 87 | + /** |
|
| 88 | + * Creates a new request helper to send POST data to the specified destination URL. |
|
| 89 | + * @param string $destinationURL |
|
| 90 | + */ |
|
| 91 | 91 | public function __construct(string $destinationURL) |
| 92 | 92 | { |
| 93 | 93 | $this->destination = $destinationURL; |
@@ -110,13 +110,13 @@ discard block |
||
| 110 | 110 | return $this->eol; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * Sets the timeout for the request, in seconds. If the request |
|
| 115 | - * takes longer, it will be cancelled and an exception triggered. |
|
| 116 | - * |
|
| 117 | - * @param int $seconds |
|
| 118 | - * @return RequestHelper |
|
| 119 | - */ |
|
| 113 | + /** |
|
| 114 | + * Sets the timeout for the request, in seconds. If the request |
|
| 115 | + * takes longer, it will be cancelled and an exception triggered. |
|
| 116 | + * |
|
| 117 | + * @param int $seconds |
|
| 118 | + * @return RequestHelper |
|
| 119 | + */ |
|
| 120 | 120 | public function setTimeout(int $seconds) : RequestHelper |
| 121 | 121 | { |
| 122 | 122 | $this->timeout = $seconds; |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | return $this->timeout; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * Enables verbose logging of the CURL request, which |
|
| 134 | - * is then redirected to the target file. |
|
| 135 | - * |
|
| 136 | - * @param string $targetFile |
|
| 137 | - * @return RequestHelper |
|
| 138 | - */ |
|
| 132 | + /** |
|
| 133 | + * Enables verbose logging of the CURL request, which |
|
| 134 | + * is then redirected to the target file. |
|
| 135 | + * |
|
| 136 | + * @param string $targetFile |
|
| 137 | + * @return RequestHelper |
|
| 138 | + */ |
|
| 139 | 139 | public function enableLogging(string $targetFile) : RequestHelper |
| 140 | 140 | { |
| 141 | 141 | $this->logfile = $targetFile; |
@@ -143,15 +143,15 @@ discard block |
||
| 143 | 143 | return $this; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - /** |
|
| 147 | - * Adds a file to be sent with the request. |
|
| 148 | - * |
|
| 149 | - * @param string $varName The variable name to send the file in |
|
| 150 | - * @param string $fileName The name of the file as it should be received at the destination |
|
| 151 | - * @param string $content The raw content of the file |
|
| 152 | - * @param string $contentType The content type, use the constants to specify this |
|
| 153 | - * @param string $encoding The encoding of the file, use the constants to specify this |
|
| 154 | - */ |
|
| 146 | + /** |
|
| 147 | + * Adds a file to be sent with the request. |
|
| 148 | + * |
|
| 149 | + * @param string $varName The variable name to send the file in |
|
| 150 | + * @param string $fileName The name of the file as it should be received at the destination |
|
| 151 | + * @param string $content The raw content of the file |
|
| 152 | + * @param string $contentType The content type, use the constants to specify this |
|
| 153 | + * @param string $encoding The encoding of the file, use the constants to specify this |
|
| 154 | + */ |
|
| 155 | 155 | public function addFile(string $varName, string $fileName, string $content, string $contentType = '', string $encoding = '') : RequestHelper |
| 156 | 156 | { |
| 157 | 157 | $this->boundaries->addFile($varName, $fileName, $content, $contentType, $encoding); |
@@ -159,13 +159,13 @@ discard block |
||
| 159 | 159 | return $this; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - /** |
|
| 163 | - * Adds arbitrary content. |
|
| 164 | - * |
|
| 165 | - * @param string $varName The variable name to send the content in. |
|
| 166 | - * @param string $content |
|
| 167 | - * @param string $contentType |
|
| 168 | - */ |
|
| 162 | + /** |
|
| 163 | + * Adds arbitrary content. |
|
| 164 | + * |
|
| 165 | + * @param string $varName The variable name to send the content in. |
|
| 166 | + * @param string $content |
|
| 167 | + * @param string $contentType |
|
| 168 | + */ |
|
| 169 | 169 | public function addContent(string $varName, string $content, string $contentType) : RequestHelper |
| 170 | 170 | { |
| 171 | 171 | $this->boundaries->addContent($varName, $content, $contentType); |
@@ -173,13 +173,13 @@ discard block |
||
| 173 | 173 | return $this; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - /** |
|
| 177 | - * Adds a variable to be sent with the request. If it |
|
| 178 | - * already exists, its value is overwritten. |
|
| 179 | - * |
|
| 180 | - * @param string $name |
|
| 181 | - * @param string $value |
|
| 182 | - */ |
|
| 176 | + /** |
|
| 177 | + * Adds a variable to be sent with the request. If it |
|
| 178 | + * already exists, its value is overwritten. |
|
| 179 | + * |
|
| 180 | + * @param string $name |
|
| 181 | + * @param string $value |
|
| 182 | + */ |
|
| 183 | 183 | public function addVariable(string $name, string $value) : RequestHelper |
| 184 | 184 | { |
| 185 | 185 | $this->boundaries->addVariable($name, $value); |
@@ -187,13 +187,13 @@ discard block |
||
| 187 | 187 | return $this; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - /** |
|
| 191 | - * Sets an HTTP header to include in the request. |
|
| 192 | - * |
|
| 193 | - * @param string $name |
|
| 194 | - * @param string $value |
|
| 195 | - * @return RequestHelper |
|
| 196 | - */ |
|
| 190 | + /** |
|
| 191 | + * Sets an HTTP header to include in the request. |
|
| 192 | + * |
|
| 193 | + * @param string $name |
|
| 194 | + * @param string $value |
|
| 195 | + * @return RequestHelper |
|
| 196 | + */ |
|
| 197 | 197 | public function setHeader(string $name, string $value) : RequestHelper |
| 198 | 198 | { |
| 199 | 199 | $this->headers[$name] = $value; |
@@ -201,36 +201,36 @@ discard block |
||
| 201 | 201 | return $this; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - /** |
|
| 205 | - * Disables SSL certificate checking. |
|
| 206 | - * |
|
| 207 | - * @return RequestHelper |
|
| 208 | - */ |
|
| 204 | + /** |
|
| 205 | + * Disables SSL certificate checking. |
|
| 206 | + * |
|
| 207 | + * @return RequestHelper |
|
| 208 | + */ |
|
| 209 | 209 | public function disableSSLChecks() : RequestHelper |
| 210 | 210 | { |
| 211 | 211 | $this->verifySSL = false; |
| 212 | 212 | return $this; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - /** |
|
| 216 | - * @var integer |
|
| 217 | - */ |
|
| 215 | + /** |
|
| 216 | + * @var integer |
|
| 217 | + */ |
|
| 218 | 218 | protected $contentLength = 0; |
| 219 | 219 | |
| 220 | - /** |
|
| 221 | - * Sends the POST request to the destination, and returns |
|
| 222 | - * the response text. |
|
| 223 | - * |
|
| 224 | - * The response object is stored internally, so after calling |
|
| 225 | - * this method it may be retrieved at any moment using the |
|
| 226 | - * {@link getResponse()} method. |
|
| 227 | - * |
|
| 228 | - * @return string |
|
| 229 | - * @see RequestHelper::getResponse() |
|
| 230 | - * @throws RequestHelper_Exception |
|
| 231 | - * |
|
| 232 | - * @see RequestHelper::ERROR_REQUEST_FAILED |
|
| 233 | - */ |
|
| 220 | + /** |
|
| 221 | + * Sends the POST request to the destination, and returns |
|
| 222 | + * the response text. |
|
| 223 | + * |
|
| 224 | + * The response object is stored internally, so after calling |
|
| 225 | + * this method it may be retrieved at any moment using the |
|
| 226 | + * {@link getResponse()} method. |
|
| 227 | + * |
|
| 228 | + * @return string |
|
| 229 | + * @see RequestHelper::getResponse() |
|
| 230 | + * @throws RequestHelper_Exception |
|
| 231 | + * |
|
| 232 | + * @see RequestHelper::ERROR_REQUEST_FAILED |
|
| 233 | + */ |
|
| 234 | 234 | public function send() : string |
| 235 | 235 | { |
| 236 | 236 | $info = parseURL($this->destination); |
@@ -270,26 +270,26 @@ discard block |
||
| 270 | 270 | return $this->response->getResponseBody(); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - /** |
|
| 274 | - * Retrieves the request's body content. This is an alias |
|
| 275 | - * for {@see RequestHelper::getMimeBody()}. |
|
| 276 | - * |
|
| 277 | - * @return string |
|
| 278 | - * @see RequestHelper::getMimeBody() |
|
| 279 | - */ |
|
| 273 | + /** |
|
| 274 | + * Retrieves the request's body content. This is an alias |
|
| 275 | + * for {@see RequestHelper::getMimeBody()}. |
|
| 276 | + * |
|
| 277 | + * @return string |
|
| 278 | + * @see RequestHelper::getMimeBody() |
|
| 279 | + */ |
|
| 280 | 280 | public function getBody() : string |
| 281 | 281 | { |
| 282 | 282 | return $this->getMimeBody(); |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - /** |
|
| 286 | - * Creates a new CURL resource configured according to the |
|
| 287 | - * request's settings. |
|
| 288 | - * |
|
| 289 | - * @param URLInfo $url |
|
| 290 | - * @throws RequestHelper_Exception |
|
| 291 | - * @return resource |
|
| 292 | - */ |
|
| 285 | + /** |
|
| 286 | + * Creates a new CURL resource configured according to the |
|
| 287 | + * request's settings. |
|
| 288 | + * |
|
| 289 | + * @param URLInfo $url |
|
| 290 | + * @throws RequestHelper_Exception |
|
| 291 | + * @return resource |
|
| 292 | + */ |
|
| 293 | 293 | protected function createCURL(URLInfo $url) |
| 294 | 294 | { |
| 295 | 295 | $ch = curl_init(); |
@@ -337,10 +337,10 @@ discard block |
||
| 337 | 337 | return $ch; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - /** |
|
| 341 | - * @param resource $ch |
|
| 342 | - * @return bool Whether logging is enabled. |
|
| 343 | - */ |
|
| 340 | + /** |
|
| 341 | + * @param resource $ch |
|
| 342 | + * @return bool Whether logging is enabled. |
|
| 343 | + */ |
|
| 344 | 344 | protected function configureLogging($ch) : bool |
| 345 | 345 | { |
| 346 | 346 | if(empty($this->logfile)) |
@@ -367,13 +367,13 @@ discard block |
||
| 367 | 367 | return true; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - /** |
|
| 371 | - * Compiles the associative headers array into |
|
| 372 | - * the format understood by CURL, namely an indexed |
|
| 373 | - * array with one header string per entry. |
|
| 374 | - * |
|
| 375 | - * @return array |
|
| 376 | - */ |
|
| 370 | + /** |
|
| 371 | + * Compiles the associative headers array into |
|
| 372 | + * the format understood by CURL, namely an indexed |
|
| 373 | + * array with one header string per entry. |
|
| 374 | + * |
|
| 375 | + * @return array |
|
| 376 | + */ |
|
| 377 | 377 | protected function renderHeaders() : array |
| 378 | 378 | { |
| 379 | 379 | $result = array(); |
@@ -387,12 +387,12 @@ discard block |
||
| 387 | 387 | return $result; |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - /** |
|
| 391 | - * Retrieves the raw response header, in the form of an indexed |
|
| 392 | - * array containing all response header lines. |
|
| 393 | - * |
|
| 394 | - * @return array |
|
| 395 | - */ |
|
| 390 | + /** |
|
| 391 | + * Retrieves the raw response header, in the form of an indexed |
|
| 392 | + * array containing all response header lines. |
|
| 393 | + * |
|
| 394 | + * @return array |
|
| 395 | + */ |
|
| 396 | 396 | public function getResponseHeader() : array |
| 397 | 397 | { |
| 398 | 398 | $response = $this->getResponse(); |
@@ -404,33 +404,33 @@ discard block |
||
| 404 | 404 | return array(); |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | - /** |
|
| 408 | - * After calling the {@link send()} method, this may be used to |
|
| 409 | - * retrieve the response text from the POST request. |
|
| 410 | - * |
|
| 411 | - * @return RequestHelper_Response|NULL |
|
| 412 | - */ |
|
| 407 | + /** |
|
| 408 | + * After calling the {@link send()} method, this may be used to |
|
| 409 | + * retrieve the response text from the POST request. |
|
| 410 | + * |
|
| 411 | + * @return RequestHelper_Response|NULL |
|
| 412 | + */ |
|
| 413 | 413 | public function getResponse() : ?RequestHelper_Response |
| 414 | 414 | { |
| 415 | 415 | return $this->response; |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - /** |
|
| 419 | - * Retrieves all headers set until now. |
|
| 420 | - * |
|
| 421 | - * @return array<string,string> |
|
| 422 | - */ |
|
| 418 | + /** |
|
| 419 | + * Retrieves all headers set until now. |
|
| 420 | + * |
|
| 421 | + * @return array<string,string> |
|
| 422 | + */ |
|
| 423 | 423 | public function getHeaders() : array |
| 424 | 424 | { |
| 425 | 425 | return $this->headers; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - /** |
|
| 429 | - * Retrieves the value of a header by its name. |
|
| 430 | - * |
|
| 431 | - * @param string $name |
|
| 432 | - * @return string The header value, or an empty string if not set. |
|
| 433 | - */ |
|
| 428 | + /** |
|
| 429 | + * Retrieves the value of a header by its name. |
|
| 430 | + * |
|
| 431 | + * @param string $name |
|
| 432 | + * @return string The header value, or an empty string if not set. |
|
| 433 | + */ |
|
| 434 | 434 | public function getHeader(string $name) : string |
| 435 | 435 | { |
| 436 | 436 | if(isset($this->headers[$name])) |