@@ -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 | |
@@ -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])) |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | public const ERROR_CANNOT_APPEND_FRAGMENT = 491001; |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var boolean |
|
| 33 | - */ |
|
| 31 | + /** |
|
| 32 | + * @var boolean |
|
| 33 | + */ |
|
| 34 | 34 | private static $simulation = false; |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | private $dom; |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Creates a new XMLHelper instance. |
|
| 43 | - * |
|
| 44 | - * @return XMLHelper |
|
| 45 | - */ |
|
| 41 | + /** |
|
| 42 | + * Creates a new XMLHelper instance. |
|
| 43 | + * |
|
| 44 | + * @return XMLHelper |
|
| 45 | + */ |
|
| 46 | 46 | public static function create() : XMLHelper |
| 47 | 47 | { |
| 48 | 48 | $dom = new DOMDocument('1.0', 'UTF-8'); |
@@ -51,72 +51,72 @@ discard block |
||
| 51 | 51 | return new XMLHelper($dom); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Creates a converter instance from an XML file. |
|
| 56 | - * @param string $xmlFile |
|
| 57 | - * @return XMLHelper_Converter |
|
| 58 | - */ |
|
| 54 | + /** |
|
| 55 | + * Creates a converter instance from an XML file. |
|
| 56 | + * @param string $xmlFile |
|
| 57 | + * @return XMLHelper_Converter |
|
| 58 | + */ |
|
| 59 | 59 | public static function convertFile(string $xmlFile) : XMLHelper_Converter |
| 60 | 60 | { |
| 61 | 61 | return XMLHelper_Converter::fromFile($xmlFile); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Creates a converter from an XML string. |
|
| 66 | - * @param string $xmlString |
|
| 67 | - * @return XMLHelper_Converter |
|
| 68 | - */ |
|
| 64 | + /** |
|
| 65 | + * Creates a converter from an XML string. |
|
| 66 | + * @param string $xmlString |
|
| 67 | + * @return XMLHelper_Converter |
|
| 68 | + */ |
|
| 69 | 69 | public static function convertString(string $xmlString) : XMLHelper_Converter |
| 70 | 70 | { |
| 71 | 71 | return XMLHelper_Converter::fromString($xmlString); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Creates a converter from a SimpleXMLElement instance. |
|
| 76 | - * @param SimpleXMLElement $element |
|
| 77 | - * @return XMLHelper_Converter |
|
| 78 | - */ |
|
| 74 | + /** |
|
| 75 | + * Creates a converter from a SimpleXMLElement instance. |
|
| 76 | + * @param SimpleXMLElement $element |
|
| 77 | + * @return XMLHelper_Converter |
|
| 78 | + */ |
|
| 79 | 79 | public static function convertElement(SimpleXMLElement $element) : XMLHelper_Converter |
| 80 | 80 | { |
| 81 | 81 | return XMLHelper_Converter::fromElement($element); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * Creates a converter from a DOMElement instance. |
|
| 86 | - * @param DOMElement $element |
|
| 87 | - * @return XMLHelper_Converter |
|
| 88 | - */ |
|
| 84 | + /** |
|
| 85 | + * Creates a converter from a DOMElement instance. |
|
| 86 | + * @param DOMElement $element |
|
| 87 | + * @return XMLHelper_Converter |
|
| 88 | + */ |
|
| 89 | 89 | public static function convertDOMElement(DOMElement $element) : XMLHelper_Converter |
| 90 | 90 | { |
| 91 | 91 | return XMLHelper_Converter::fromDOMElement($element); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * Creates a new helper using an existing DOMDocument object. |
|
| 96 | - * @param DOMDocument $dom |
|
| 97 | - */ |
|
| 94 | + /** |
|
| 95 | + * Creates a new helper using an existing DOMDocument object. |
|
| 96 | + * @param DOMDocument $dom |
|
| 97 | + */ |
|
| 98 | 98 | public function __construct(DOMDocument $dom) |
| 99 | 99 | { |
| 100 | 100 | $this->dom = $dom; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - /** |
|
| 104 | - * @return DOMDocument |
|
| 105 | - */ |
|
| 103 | + /** |
|
| 104 | + * @return DOMDocument |
|
| 105 | + */ |
|
| 106 | 106 | public function getDOM() : DOMDocument |
| 107 | 107 | { |
| 108 | 108 | return $this->dom; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - /** |
|
| 112 | - * Adds an attribute to an existing tag with |
|
| 113 | - * the specified value. |
|
| 114 | - * |
|
| 115 | - * @param DOMNode $parent |
|
| 116 | - * @param string $name |
|
| 117 | - * @param mixed $value |
|
| 118 | - * @return DOMNode |
|
| 119 | - */ |
|
| 111 | + /** |
|
| 112 | + * Adds an attribute to an existing tag with |
|
| 113 | + * the specified value. |
|
| 114 | + * |
|
| 115 | + * @param DOMNode $parent |
|
| 116 | + * @param string $name |
|
| 117 | + * @param mixed $value |
|
| 118 | + * @return DOMNode |
|
| 119 | + */ |
|
| 120 | 120 | public function addAttribute(DOMNode $parent, string $name, $value) |
| 121 | 121 | { |
| 122 | 122 | $node = $this->dom->createAttribute($name); |
@@ -126,12 +126,12 @@ discard block |
||
| 126 | 126 | return $parent->appendChild($node); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - /** |
|
| 130 | - * Adds several attributes to the target node. |
|
| 131 | - * |
|
| 132 | - * @param DOMNode $parent |
|
| 133 | - * @param array<string,mixed> $attributes |
|
| 134 | - */ |
|
| 129 | + /** |
|
| 130 | + * Adds several attributes to the target node. |
|
| 131 | + * |
|
| 132 | + * @param DOMNode $parent |
|
| 133 | + * @param array<string,mixed> $attributes |
|
| 134 | + */ |
|
| 135 | 135 | public function addAttributes(DOMNode $parent, array $attributes) : void |
| 136 | 136 | { |
| 137 | 137 | foreach ($attributes as $name => $value) { |
@@ -139,14 +139,14 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - /** |
|
| 143 | - * Adds a tag without content. |
|
| 144 | - * |
|
| 145 | - * @param DOMNode $parent |
|
| 146 | - * @param string $name |
|
| 147 | - * @param integer $indent |
|
| 148 | - * @return DOMNode |
|
| 149 | - */ |
|
| 142 | + /** |
|
| 143 | + * Adds a tag without content. |
|
| 144 | + * |
|
| 145 | + * @param DOMNode $parent |
|
| 146 | + * @param string $name |
|
| 147 | + * @param integer $indent |
|
| 148 | + * @return DOMNode |
|
| 149 | + */ |
|
| 150 | 150 | public function addTag(DOMNode $parent, string $name, int $indent = 0) : DOMNode |
| 151 | 151 | { |
| 152 | 152 | if ($indent > 0) { |
@@ -168,17 +168,17 @@ discard block |
||
| 168 | 168 | $parent->appendChild($this->dom->createTextNode(str_repeat("\t", $amount))); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - /** |
|
| 172 | - * Adds a tag with textual content, like: |
|
| 173 | - * |
|
| 174 | - * <tagname>text</tagname> |
|
| 175 | - * |
|
| 176 | - * @param DOMNode $parent |
|
| 177 | - * @param string $name |
|
| 178 | - * @param string $text |
|
| 179 | - * @param integer $indent |
|
| 180 | - * @return DOMNode |
|
| 181 | - */ |
|
| 171 | + /** |
|
| 172 | + * Adds a tag with textual content, like: |
|
| 173 | + * |
|
| 174 | + * <tagname>text</tagname> |
|
| 175 | + * |
|
| 176 | + * @param DOMNode $parent |
|
| 177 | + * @param string $name |
|
| 178 | + * @param string $text |
|
| 179 | + * @param integer $indent |
|
| 180 | + * @return DOMNode |
|
| 181 | + */ |
|
| 182 | 182 | public function addTextTag(DOMNode $parent, string $name, string $text, int $indent = 0) : DOMNode |
| 183 | 183 | { |
| 184 | 184 | if ($indent > 0) { |
@@ -192,19 +192,19 @@ discard block |
||
| 192 | 192 | return $parent->appendChild($tag); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - /** |
|
| 196 | - * Adds a tag with textual content, like: |
|
| 197 | - * |
|
| 198 | - * <tagname>text</tagname> |
|
| 199 | - * |
|
| 200 | - * and removes <p> tags |
|
| 201 | - * |
|
| 202 | - * @param DOMNode $parent |
|
| 203 | - * @param string $name |
|
| 204 | - * @param string $text |
|
| 205 | - * @param integer $indent |
|
| 206 | - * @return DOMNode |
|
| 207 | - */ |
|
| 195 | + /** |
|
| 196 | + * Adds a tag with textual content, like: |
|
| 197 | + * |
|
| 198 | + * <tagname>text</tagname> |
|
| 199 | + * |
|
| 200 | + * and removes <p> tags |
|
| 201 | + * |
|
| 202 | + * @param DOMNode $parent |
|
| 203 | + * @param string $name |
|
| 204 | + * @param string $text |
|
| 205 | + * @param integer $indent |
|
| 206 | + * @return DOMNode |
|
| 207 | + */ |
|
| 208 | 208 | public function addEscapedTag(DOMNode $parent, string $name, string $text, int $indent = 0) |
| 209 | 209 | { |
| 210 | 210 | if ($indent > 0) { |
@@ -220,19 +220,19 @@ discard block |
||
| 220 | 220 | return $parent->appendChild($tag); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - /** |
|
| 224 | - * Adds a tag with HTML content, like: |
|
| 225 | - * |
|
| 226 | - * <tagname><i>text</i></tagname> |
|
| 227 | - * |
|
| 228 | - * Tags will not be escaped. |
|
| 229 | - * |
|
| 230 | - * @param DOMNode $parent |
|
| 231 | - * @param string $name |
|
| 232 | - * @param string $text |
|
| 233 | - * @param integer $indent |
|
| 234 | - * @return DOMNode |
|
| 235 | - */ |
|
| 223 | + /** |
|
| 224 | + * Adds a tag with HTML content, like: |
|
| 225 | + * |
|
| 226 | + * <tagname><i>text</i></tagname> |
|
| 227 | + * |
|
| 228 | + * Tags will not be escaped. |
|
| 229 | + * |
|
| 230 | + * @param DOMNode $parent |
|
| 231 | + * @param string $name |
|
| 232 | + * @param string $text |
|
| 233 | + * @param integer $indent |
|
| 234 | + * @return DOMNode |
|
| 235 | + */ |
|
| 236 | 236 | public function addFragmentTag(DOMNode $parent, string $name, string $text, int $indent = 0) |
| 237 | 237 | { |
| 238 | 238 | if ($indent > 0) { |
@@ -260,16 +260,16 @@ discard block |
||
| 260 | 260 | return $parent->appendChild($tag); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - /** |
|
| 264 | - * Adds a tag with CDATA content, like: |
|
| 265 | - * |
|
| 266 | - * <tagname><![CDATA[value]]></tagname> |
|
| 267 | - * |
|
| 268 | - * @param DOMNode $parent |
|
| 269 | - * @param string $name |
|
| 270 | - * @param string $content |
|
| 271 | - * @return DOMNode |
|
| 272 | - */ |
|
| 263 | + /** |
|
| 264 | + * Adds a tag with CDATA content, like: |
|
| 265 | + * |
|
| 266 | + * <tagname><![CDATA[value]]></tagname> |
|
| 267 | + * |
|
| 268 | + * @param DOMNode $parent |
|
| 269 | + * @param string $name |
|
| 270 | + * @param string $content |
|
| 271 | + * @return DOMNode |
|
| 272 | + */ |
|
| 273 | 273 | public function addCDATATag(DOMNode $parent, string $name, string $content) : DOMNode |
| 274 | 274 | { |
| 275 | 275 | $tag = $this->dom->createElement($name); |
@@ -279,12 +279,12 @@ discard block |
||
| 279 | 279 | return $parent->appendChild($tag); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - /** |
|
| 283 | - * Creates the root element of the document. |
|
| 284 | - * @param string $name |
|
| 285 | - * @param array<string,mixed> $attributes |
|
| 286 | - * @return DOMNode |
|
| 287 | - */ |
|
| 282 | + /** |
|
| 283 | + * Creates the root element of the document. |
|
| 284 | + * @param string $name |
|
| 285 | + * @param array<string,mixed> $attributes |
|
| 286 | + * @return DOMNode |
|
| 287 | + */ |
|
| 288 | 288 | public function createRoot(string $name, array $attributes=array()) |
| 289 | 289 | { |
| 290 | 290 | $root = $this->dom->appendChild($this->dom->createElement($name)); |
@@ -292,12 +292,12 @@ discard block |
||
| 292 | 292 | return $root; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - /** |
|
| 296 | - * Escaped the string for use in XML. |
|
| 297 | - * |
|
| 298 | - * @param string $string |
|
| 299 | - * @return string |
|
| 300 | - */ |
|
| 295 | + /** |
|
| 296 | + * Escaped the string for use in XML. |
|
| 297 | + * |
|
| 298 | + * @param string $string |
|
| 299 | + * @return string |
|
| 300 | + */ |
|
| 301 | 301 | public function escape(string $string) : string |
| 302 | 302 | { |
| 303 | 303 | $string = preg_replace('#<p>(.*)</p>#isUm', '$1', $string); |
@@ -317,18 +317,18 @@ discard block |
||
| 317 | 317 | return $string; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - /** |
|
| 321 | - * Sends the specified XML string to the browser with |
|
| 322 | - * the correct headers to trigger a download of the XML |
|
| 323 | - * to a local file. |
|
| 324 | - * |
|
| 325 | - * NOTE: Ensure calling exit after this is done, and to |
|
| 326 | - * not send additional content, which would corrupt the |
|
| 327 | - * download. |
|
| 328 | - * |
|
| 329 | - * @param string $xml |
|
| 330 | - * @param string $filename |
|
| 331 | - */ |
|
| 320 | + /** |
|
| 321 | + * Sends the specified XML string to the browser with |
|
| 322 | + * the correct headers to trigger a download of the XML |
|
| 323 | + * to a local file. |
|
| 324 | + * |
|
| 325 | + * NOTE: Ensure calling exit after this is done, and to |
|
| 326 | + * not send additional content, which would corrupt the |
|
| 327 | + * download. |
|
| 328 | + * |
|
| 329 | + * @param string $xml |
|
| 330 | + * @param string $filename |
|
| 331 | + */ |
|
| 332 | 332 | public static function downloadXML(string $xml, string $filename = 'download.xml') : void |
| 333 | 333 | { |
| 334 | 334 | if(!headers_sent() && !self::$simulation) |
@@ -339,12 +339,12 @@ discard block |
||
| 339 | 339 | echo $xml; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - /** |
|
| 343 | - * Sends the specified XML string to the browser with |
|
| 344 | - * the correct headers and terminates the request. |
|
| 345 | - * |
|
| 346 | - * @param string $xml |
|
| 347 | - */ |
|
| 342 | + /** |
|
| 343 | + * Sends the specified XML string to the browser with |
|
| 344 | + * the correct headers and terminates the request. |
|
| 345 | + * |
|
| 346 | + * @param string $xml |
|
| 347 | + */ |
|
| 348 | 348 | public static function displayXML(string $xml) : void |
| 349 | 349 | { |
| 350 | 350 | if(!headers_sent() && !self::$simulation) |
@@ -411,23 +411,23 @@ discard block |
||
| 411 | 411 | return $xml->saveXML(); |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | - /** |
|
| 415 | - * Creates XML markup to describe an application error |
|
| 416 | - * when using XML services. Creates XML with the |
|
| 417 | - * following structure: |
|
| 418 | - * |
|
| 419 | - * <error> |
|
| 420 | - * <id>99</id> |
|
| 421 | - * <message>Full error message text</message> |
|
| 422 | - * <title>Short error label</title> |
|
| 423 | - * </error> |
|
| 424 | - * |
|
| 425 | - * @param string|number $code |
|
| 426 | - * @param string $message |
|
| 427 | - * @param string $title |
|
| 428 | - * @param array<string,string> $customInfo |
|
| 429 | - * @return string |
|
| 430 | - */ |
|
| 414 | + /** |
|
| 415 | + * Creates XML markup to describe an application error |
|
| 416 | + * when using XML services. Creates XML with the |
|
| 417 | + * following structure: |
|
| 418 | + * |
|
| 419 | + * <error> |
|
| 420 | + * <id>99</id> |
|
| 421 | + * <message>Full error message text</message> |
|
| 422 | + * <title>Short error label</title> |
|
| 423 | + * </error> |
|
| 424 | + * |
|
| 425 | + * @param string|number $code |
|
| 426 | + * @param string $message |
|
| 427 | + * @param string $title |
|
| 428 | + * @param array<string,string> $customInfo |
|
| 429 | + * @return string |
|
| 430 | + */ |
|
| 431 | 431 | public static function buildErrorXML($code, string $message, string $title, array $customInfo=array()) |
| 432 | 432 | { |
| 433 | 433 | $xml = new DOMDocument('1.0', 'UTF-8'); |
@@ -460,31 +460,31 @@ discard block |
||
| 460 | 460 | return $this->dom->saveXML(); |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - /** |
|
| 464 | - * Creates a new SimpleXML helper instance: this |
|
| 465 | - * object is useful to work with loading XML strings |
|
| 466 | - * and files with easy access to any errors that |
|
| 467 | - * may occurr, since the simplexml functions can be |
|
| 468 | - * somewhat cryptic. |
|
| 469 | - * |
|
| 470 | - * @return XMLHelper_SimpleXML |
|
| 471 | - */ |
|
| 463 | + /** |
|
| 464 | + * Creates a new SimpleXML helper instance: this |
|
| 465 | + * object is useful to work with loading XML strings |
|
| 466 | + * and files with easy access to any errors that |
|
| 467 | + * may occurr, since the simplexml functions can be |
|
| 468 | + * somewhat cryptic. |
|
| 469 | + * |
|
| 470 | + * @return XMLHelper_SimpleXML |
|
| 471 | + */ |
|
| 472 | 472 | public static function createSimplexml() : XMLHelper_SimpleXML |
| 473 | 473 | { |
| 474 | 474 | return new XMLHelper_SimpleXML(); |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | - /** |
|
| 478 | - * Converts a string to valid XML: can be a text only string |
|
| 479 | - * or an HTML string. Returns valid XML code. |
|
| 480 | - * |
|
| 481 | - * NOTE: The string may contain custom tags, which are |
|
| 482 | - * preserved. |
|
| 483 | - * |
|
| 484 | - * @param string $string |
|
| 485 | - * @throws XMLHelper_Exception |
|
| 486 | - * @return string |
|
| 487 | - */ |
|
| 477 | + /** |
|
| 478 | + * Converts a string to valid XML: can be a text only string |
|
| 479 | + * or an HTML string. Returns valid XML code. |
|
| 480 | + * |
|
| 481 | + * NOTE: The string may contain custom tags, which are |
|
| 482 | + * preserved. |
|
| 483 | + * |
|
| 484 | + * @param string $string |
|
| 485 | + * @throws XMLHelper_Exception |
|
| 486 | + * @return string |
|
| 487 | + */ |
|
| 488 | 488 | public static function string2xml(string $string) : string |
| 489 | 489 | { |
| 490 | 490 | return XMLHelper_HTMLLoader::loadFragment($string)->fragmentToXML(); |
@@ -34,46 +34,46 @@ discard block |
||
| 34 | 34 | public const TYPE_ERROR = 'error'; |
| 35 | 35 | public const TYPE_SUCCESS = 'success'; |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @var string |
|
| 39 | - */ |
|
| 37 | + /** |
|
| 38 | + * @var string |
|
| 39 | + */ |
|
| 40 | 40 | protected $message = ''; |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @var bool |
|
| 44 | - */ |
|
| 42 | + /** |
|
| 43 | + * @var bool |
|
| 44 | + */ |
|
| 45 | 45 | protected $valid = true; |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @var object |
|
| 49 | - */ |
|
| 47 | + /** |
|
| 48 | + * @var object |
|
| 49 | + */ |
|
| 50 | 50 | protected $subject; |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @var integer |
|
| 54 | - */ |
|
| 52 | + /** |
|
| 53 | + * @var integer |
|
| 54 | + */ |
|
| 55 | 55 | protected $code = 0; |
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @var string |
|
| 59 | - */ |
|
| 57 | + /** |
|
| 58 | + * @var string |
|
| 59 | + */ |
|
| 60 | 60 | protected $type = ''; |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * @var integer |
|
| 64 | - */ |
|
| 62 | + /** |
|
| 63 | + * @var integer |
|
| 64 | + */ |
|
| 65 | 65 | private static $counter = 0; |
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * @var int |
|
| 69 | - */ |
|
| 67 | + /** |
|
| 68 | + * @var int |
|
| 69 | + */ |
|
| 70 | 70 | private $id; |
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * The subject being validated. |
|
| 74 | - * |
|
| 75 | - * @param object $subject |
|
| 76 | - */ |
|
| 72 | + /** |
|
| 73 | + * The subject being validated. |
|
| 74 | + * |
|
| 75 | + * @param object $subject |
|
| 76 | + */ |
|
| 77 | 77 | public function __construct(object $subject) |
| 78 | 78 | { |
| 79 | 79 | $this->subject = $subject; |
@@ -83,21 +83,21 @@ discard block |
||
| 83 | 83 | $this->id = self::$counter; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * Retrieves the ID of the result, which is unique within a request. |
|
| 88 | - * |
|
| 89 | - * @return int |
|
| 90 | - */ |
|
| 86 | + /** |
|
| 87 | + * Retrieves the ID of the result, which is unique within a request. |
|
| 88 | + * |
|
| 89 | + * @return int |
|
| 90 | + */ |
|
| 91 | 91 | public function getID() : int |
| 92 | 92 | { |
| 93 | 93 | return $this->id; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Whether the validation was successful. |
|
| 98 | - * |
|
| 99 | - * @return bool |
|
| 100 | - */ |
|
| 96 | + /** |
|
| 97 | + * Whether the validation was successful. |
|
| 98 | + * |
|
| 99 | + * @return bool |
|
| 100 | + */ |
|
| 101 | 101 | public function isValid() : bool |
| 102 | 102 | { |
| 103 | 103 | return $this->valid; |
@@ -128,33 +128,33 @@ discard block |
||
| 128 | 128 | return $this->type === $type; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - /** |
|
| 132 | - * Retrieves the subject that was validated. |
|
| 133 | - * |
|
| 134 | - * @return object |
|
| 135 | - */ |
|
| 131 | + /** |
|
| 132 | + * Retrieves the subject that was validated. |
|
| 133 | + * |
|
| 134 | + * @return object |
|
| 135 | + */ |
|
| 136 | 136 | public function getSubject() : object |
| 137 | 137 | { |
| 138 | 138 | return $this->subject; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - /** |
|
| 142 | - * Makes the result a success, with the specified message. |
|
| 143 | - * |
|
| 144 | - * @param string $message Should not contain a date, just the system specific info. |
|
| 145 | - * @return $this |
|
| 146 | - */ |
|
| 141 | + /** |
|
| 142 | + * Makes the result a success, with the specified message. |
|
| 143 | + * |
|
| 144 | + * @param string $message Should not contain a date, just the system specific info. |
|
| 145 | + * @return $this |
|
| 146 | + */ |
|
| 147 | 147 | public function makeSuccess(string $message, int $code=0) : OperationResult |
| 148 | 148 | { |
| 149 | 149 | return $this->setMessage(self::TYPE_SUCCESS, $message, $code, true); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - /** |
|
| 153 | - * Sets the result as an error. |
|
| 154 | - * |
|
| 155 | - * @param string $message Should be as detailed as possible. |
|
| 156 | - * @return $this |
|
| 157 | - */ |
|
| 152 | + /** |
|
| 153 | + * Sets the result as an error. |
|
| 154 | + * |
|
| 155 | + * @param string $message Should be as detailed as possible. |
|
| 156 | + * @return $this |
|
| 157 | + */ |
|
| 158 | 158 | public function makeError(string $message, int $code=0) : OperationResult |
| 159 | 159 | { |
| 160 | 160 | return $this->setMessage(self::TYPE_ERROR, $message, $code, false); |
@@ -202,21 +202,21 @@ discard block |
||
| 202 | 202 | return $this->type; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - /** |
|
| 206 | - * Retrieves the error message, if an error occurred. |
|
| 207 | - * |
|
| 208 | - * @return string The error message, or an empty string if no error occurred. |
|
| 209 | - */ |
|
| 205 | + /** |
|
| 206 | + * Retrieves the error message, if an error occurred. |
|
| 207 | + * |
|
| 208 | + * @return string The error message, or an empty string if no error occurred. |
|
| 209 | + */ |
|
| 210 | 210 | public function getErrorMessage() : string |
| 211 | 211 | { |
| 212 | 212 | return $this->getMessage(self::TYPE_ERROR); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - /** |
|
| 216 | - * Retrieves the success message, if one has been provided. |
|
| 217 | - * |
|
| 218 | - * @return string |
|
| 219 | - */ |
|
| 215 | + /** |
|
| 216 | + * Retrieves the success message, if one has been provided. |
|
| 217 | + * |
|
| 218 | + * @return string |
|
| 219 | + */ |
|
| 220 | 220 | public function getSuccessMessage() : string |
| 221 | 221 | { |
| 222 | 222 | return $this->getMessage(self::TYPE_SUCCESS); |
@@ -232,21 +232,21 @@ discard block |
||
| 232 | 232 | return $this->getMessage(self::TYPE_WARNING); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - /** |
|
| 236 | - * Whether a specific error/success code has been specified. |
|
| 237 | - * |
|
| 238 | - * @return bool |
|
| 239 | - */ |
|
| 235 | + /** |
|
| 236 | + * Whether a specific error/success code has been specified. |
|
| 237 | + * |
|
| 238 | + * @return bool |
|
| 239 | + */ |
|
| 240 | 240 | public function hasCode() : bool |
| 241 | 241 | { |
| 242 | 242 | return $this->code > 0; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - /** |
|
| 246 | - * Retrieves the error/success code, if any. |
|
| 247 | - * |
|
| 248 | - * @return int The error code, or 0 if none. |
|
| 249 | - */ |
|
| 245 | + /** |
|
| 246 | + * Retrieves the error/success code, if any. |
|
| 247 | + * |
|
| 248 | + * @return int The error code, or 0 if none. |
|
| 249 | + */ |
|
| 250 | 250 | public function getCode() : int |
| 251 | 251 | { |
| 252 | 252 | return $this->code; |
@@ -23,19 +23,19 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | class ConvertHelper_TimeConverter |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * @var float |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var float |
|
| 28 | + */ |
|
| 29 | 29 | private $seconds; |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var array<int,array<string,string|int>>|NULL |
|
| 33 | - */ |
|
| 31 | + /** |
|
| 32 | + * @var array<int,array<string,string|int>>|NULL |
|
| 33 | + */ |
|
| 34 | 34 | private static $units; |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @param float $seconds |
|
| 38 | - */ |
|
| 36 | + /** |
|
| 37 | + * @param float $seconds |
|
| 38 | + */ |
|
| 39 | 39 | public function __construct($seconds) |
| 40 | 40 | { |
| 41 | 41 | $this->seconds = $seconds; |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | $this->initUnits(); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Creates the list of units once per request as needed. |
|
| 48 | - */ |
|
| 46 | + /** |
|
| 47 | + * Creates the list of units once per request as needed. |
|
| 48 | + */ |
|
| 49 | 49 | private function initUnits() : void |
| 50 | 50 | { |
| 51 | 51 | if(isset(self::$units)) |
@@ -112,11 +112,11 @@ discard block |
||
| 112 | 112 | return implode(', ', $tokens) . ' ' . t('and') . ' ' . $last; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * Resolves the list of converted units. |
|
| 117 | - * |
|
| 118 | - * @return string[] |
|
| 119 | - */ |
|
| 115 | + /** |
|
| 116 | + * Resolves the list of converted units. |
|
| 117 | + * |
|
| 118 | + * @return string[] |
|
| 119 | + */ |
|
| 120 | 120 | private function resolveTokens() : array |
| 121 | 121 | { |
| 122 | 122 | $seconds = $this->seconds; |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | public const TOKEN_MONTHS = 'm'; |
| 42 | 42 | public const TOKEN_YEARS = 'y'; |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @var DateInterval |
|
| 46 | - */ |
|
| 44 | + /** |
|
| 45 | + * @var DateInterval |
|
| 46 | + */ |
|
| 47 | 47 | protected $interval; |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @var int |
|
| 51 | - */ |
|
| 49 | + /** |
|
| 50 | + * @var int |
|
| 51 | + */ |
|
| 52 | 52 | protected $seconds; |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -92,22 +92,22 @@ discard block |
||
| 92 | 92 | return new ConvertHelper_DateInterval($seconds); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * Creates the interval from an existing regular interval instance. |
|
| 97 | - * |
|
| 98 | - * @param DateInterval $interval |
|
| 99 | - * @return ConvertHelper_DateInterval |
|
| 100 | - */ |
|
| 95 | + /** |
|
| 96 | + * Creates the interval from an existing regular interval instance. |
|
| 97 | + * |
|
| 98 | + * @param DateInterval $interval |
|
| 99 | + * @return ConvertHelper_DateInterval |
|
| 100 | + */ |
|
| 101 | 101 | public static function fromInterval(DateInterval $interval) |
| 102 | 102 | { |
| 103 | 103 | return self::fromSeconds(ConvertHelper::interval2seconds($interval)); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - /** |
|
| 107 | - * Retrieves the PHP native date interval. |
|
| 108 | - * |
|
| 109 | - * @return DateInterval |
|
| 110 | - */ |
|
| 106 | + /** |
|
| 107 | + * Retrieves the PHP native date interval. |
|
| 108 | + * |
|
| 109 | + * @return DateInterval |
|
| 110 | + */ |
|
| 111 | 111 | public function getInterval() : DateInterval |
| 112 | 112 | { |
| 113 | 113 | return $this->interval; |
@@ -143,31 +143,31 @@ discard block |
||
| 143 | 143 | return $this->getToken(self::TOKEN_YEARS); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - /** |
|
| 147 | - * Retrieves a specific time token, e.g. "h" (for hours). |
|
| 148 | - * Using the constants to specifiy the tokens is recommended. |
|
| 149 | - * |
|
| 150 | - * @param string $token |
|
| 151 | - * @return int |
|
| 152 | - * |
|
| 153 | - * @see ConvertHelper_DateInterval::TOKEN_SECONDS |
|
| 154 | - * @see ConvertHelper_DateInterval::TOKEN_MINUTES |
|
| 155 | - * @see ConvertHelper_DateInterval::TOKEN_HOURS |
|
| 156 | - * @see ConvertHelper_DateInterval::TOKEN_DAYS |
|
| 157 | - * @see ConvertHelper_DateInterval::TOKEN_MONTHS |
|
| 158 | - * @see ConvertHelper_DateInterval::TOKEN_YEARS |
|
| 159 | - */ |
|
| 146 | + /** |
|
| 147 | + * Retrieves a specific time token, e.g. "h" (for hours). |
|
| 148 | + * Using the constants to specifiy the tokens is recommended. |
|
| 149 | + * |
|
| 150 | + * @param string $token |
|
| 151 | + * @return int |
|
| 152 | + * |
|
| 153 | + * @see ConvertHelper_DateInterval::TOKEN_SECONDS |
|
| 154 | + * @see ConvertHelper_DateInterval::TOKEN_MINUTES |
|
| 155 | + * @see ConvertHelper_DateInterval::TOKEN_HOURS |
|
| 156 | + * @see ConvertHelper_DateInterval::TOKEN_DAYS |
|
| 157 | + * @see ConvertHelper_DateInterval::TOKEN_MONTHS |
|
| 158 | + * @see ConvertHelper_DateInterval::TOKEN_YEARS |
|
| 159 | + */ |
|
| 160 | 160 | public function getToken(string $token) : int |
| 161 | 161 | { |
| 162 | 162 | return (int)$this->interval->$token; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - /** |
|
| 166 | - * The total amount of seconds in the interval (including |
|
| 167 | - * everything, from seconds to days, months, years...). |
|
| 168 | - * |
|
| 169 | - * @return int |
|
| 170 | - */ |
|
| 165 | + /** |
|
| 166 | + * The total amount of seconds in the interval (including |
|
| 167 | + * everything, from seconds to days, months, years...). |
|
| 168 | + * |
|
| 169 | + * @return int |
|
| 170 | + */ |
|
| 171 | 171 | public function getTotalSeconds() : int |
| 172 | 172 | { |
| 173 | 173 | return $this->seconds; |
@@ -20,48 +20,48 @@ discard block |
||
| 20 | 20 | public const CONTEXT_WEB = 'web'; |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * @var Throwable |
|
| 24 | - */ |
|
| 23 | + * @var Throwable |
|
| 24 | + */ |
|
| 25 | 25 | protected $exception; |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var ConvertHelper_ThrowableInfo_Call[] |
|
| 29 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var ConvertHelper_ThrowableInfo_Call[] |
|
| 29 | + */ |
|
| 30 | 30 | protected $calls = array(); |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @var integer |
|
| 34 | - */ |
|
| 32 | + /** |
|
| 33 | + * @var integer |
|
| 34 | + */ |
|
| 35 | 35 | protected $code = 0; |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @var string |
|
| 39 | - */ |
|
| 37 | + /** |
|
| 38 | + * @var string |
|
| 39 | + */ |
|
| 40 | 40 | protected $message; |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @var integer |
|
| 44 | - */ |
|
| 42 | + /** |
|
| 43 | + * @var integer |
|
| 44 | + */ |
|
| 45 | 45 | protected $callsCount = 0; |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @var ConvertHelper_ThrowableInfo|NULL |
|
| 49 | - */ |
|
| 47 | + /** |
|
| 48 | + * @var ConvertHelper_ThrowableInfo|NULL |
|
| 49 | + */ |
|
| 50 | 50 | protected $previous = null; |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @var string |
|
| 54 | - */ |
|
| 52 | + /** |
|
| 53 | + * @var string |
|
| 54 | + */ |
|
| 55 | 55 | protected $referer = ''; |
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @var Microtime |
|
| 59 | - */ |
|
| 57 | + /** |
|
| 58 | + * @var Microtime |
|
| 59 | + */ |
|
| 60 | 60 | protected $date; |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * @var string |
|
| 64 | - */ |
|
| 62 | + /** |
|
| 63 | + * @var string |
|
| 64 | + */ |
|
| 65 | 65 | protected $context = self::CONTEXT_WEB; |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -127,16 +127,16 @@ discard block |
||
| 127 | 127 | return isset($this->previous); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - /** |
|
| 131 | - * Retrieves the information on the previous exception. |
|
| 132 | - * |
|
| 133 | - * NOTE: Throws an exception if there is no previous |
|
| 134 | - * exception. Use hasPrevious() first to avoid this. |
|
| 135 | - * |
|
| 136 | - * @throws ConvertHelper_Exception |
|
| 137 | - * @return ConvertHelper_ThrowableInfo |
|
| 138 | - * @see ConvertHelper_ThrowableInfo::ERROR_NO_PREVIOUS_EXCEPTION |
|
| 139 | - */ |
|
| 130 | + /** |
|
| 131 | + * Retrieves the information on the previous exception. |
|
| 132 | + * |
|
| 133 | + * NOTE: Throws an exception if there is no previous |
|
| 134 | + * exception. Use hasPrevious() first to avoid this. |
|
| 135 | + * |
|
| 136 | + * @throws ConvertHelper_Exception |
|
| 137 | + * @return ConvertHelper_ThrowableInfo |
|
| 138 | + * @see ConvertHelper_ThrowableInfo::ERROR_NO_PREVIOUS_EXCEPTION |
|
| 139 | + */ |
|
| 140 | 140 | public function getPrevious() : ConvertHelper_ThrowableInfo |
| 141 | 141 | { |
| 142 | 142 | if(isset($this->previous)) { |
@@ -155,68 +155,68 @@ discard block |
||
| 155 | 155 | return !empty($this->code); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - /** |
|
| 159 | - * Improved text-only exception trace. |
|
| 160 | - */ |
|
| 158 | + /** |
|
| 159 | + * Improved text-only exception trace. |
|
| 160 | + */ |
|
| 161 | 161 | public function toString() : string |
| 162 | 162 | { |
| 163 | 163 | return (new ConvertHelper_ThrowableInfo_StringConverter($this)) |
| 164 | 164 | ->toString(); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - /** |
|
| 168 | - * Retrieves the URL of the page in which the exception |
|
| 169 | - * was thrown, if applicable: in CLI context, this will |
|
| 170 | - * return an empty string. |
|
| 171 | - * |
|
| 172 | - * @return string |
|
| 173 | - */ |
|
| 167 | + /** |
|
| 168 | + * Retrieves the URL of the page in which the exception |
|
| 169 | + * was thrown, if applicable: in CLI context, this will |
|
| 170 | + * return an empty string. |
|
| 171 | + * |
|
| 172 | + * @return string |
|
| 173 | + */ |
|
| 174 | 174 | public function getReferer() : string |
| 175 | 175 | { |
| 176 | 176 | return $this->referer; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - /** |
|
| 180 | - * Whether the exception occurred in a command line context. |
|
| 181 | - * @return bool |
|
| 182 | - */ |
|
| 179 | + /** |
|
| 180 | + * Whether the exception occurred in a command line context. |
|
| 181 | + * @return bool |
|
| 182 | + */ |
|
| 183 | 183 | public function isCommandLine() : bool |
| 184 | 184 | { |
| 185 | 185 | return $this->getContext() === self::CONTEXT_COMMAND_LINE; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - /** |
|
| 189 | - * Whether the exception occurred during an http request. |
|
| 190 | - * @return bool |
|
| 191 | - */ |
|
| 188 | + /** |
|
| 189 | + * Whether the exception occurred during an http request. |
|
| 190 | + * @return bool |
|
| 191 | + */ |
|
| 192 | 192 | public function isWebRequest() : bool |
| 193 | 193 | { |
| 194 | 194 | return $this->getContext() === self::CONTEXT_WEB; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - /** |
|
| 198 | - * Retrieves the context identifier, i.e. if the exception |
|
| 199 | - * occurred in a command line context or regular web request. |
|
| 200 | - * |
|
| 201 | - * @return string |
|
| 202 | - * |
|
| 203 | - * @see ConvertHelper_ThrowableInfo::isCommandLine() |
|
| 204 | - * @see ConvertHelper_ThrowableInfo::isWebRequest() |
|
| 205 | - * @see ConvertHelper_ThrowableInfo::CONTEXT_COMMAND_LINE |
|
| 206 | - * @see ConvertHelper_ThrowableInfo::CONTEXT_WEB |
|
| 207 | - */ |
|
| 197 | + /** |
|
| 198 | + * Retrieves the context identifier, i.e. if the exception |
|
| 199 | + * occurred in a command line context or regular web request. |
|
| 200 | + * |
|
| 201 | + * @return string |
|
| 202 | + * |
|
| 203 | + * @see ConvertHelper_ThrowableInfo::isCommandLine() |
|
| 204 | + * @see ConvertHelper_ThrowableInfo::isWebRequest() |
|
| 205 | + * @see ConvertHelper_ThrowableInfo::CONTEXT_COMMAND_LINE |
|
| 206 | + * @see ConvertHelper_ThrowableInfo::CONTEXT_WEB |
|
| 207 | + */ |
|
| 208 | 208 | public function getContext() : string |
| 209 | 209 | { |
| 210 | 210 | return $this->context; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - /** |
|
| 214 | - * Retrieves the date of the exception, and approximate time: |
|
| 215 | - * since exceptions do not store time, this is captured the |
|
| 216 | - * moment the ThrowableInfo is created. |
|
| 217 | - * |
|
| 218 | - * @return Microtime |
|
| 219 | - */ |
|
| 213 | + /** |
|
| 214 | + * Retrieves the date of the exception, and approximate time: |
|
| 215 | + * since exceptions do not store time, this is captured the |
|
| 216 | + * moment the ThrowableInfo is created. |
|
| 217 | + * |
|
| 218 | + * @return Microtime |
|
| 219 | + */ |
|
| 220 | 220 | public function getDate() : Microtime |
| 221 | 221 | { |
| 222 | 222 | return $this->date; |
@@ -237,24 +237,24 @@ discard block |
||
| 237 | 237 | return ConvertHelper_ThrowableInfo_Serializer::serialize($this); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - /** |
|
| 241 | - * Sets the maximum folder depth to show in the |
|
| 242 | - * file paths, to avoid them being too long. |
|
| 243 | - * |
|
| 244 | - * @param int $depth |
|
| 245 | - * @return ConvertHelper_ThrowableInfo |
|
| 246 | - */ |
|
| 240 | + /** |
|
| 241 | + * Sets the maximum folder depth to show in the |
|
| 242 | + * file paths, to avoid them being too long. |
|
| 243 | + * |
|
| 244 | + * @param int $depth |
|
| 245 | + * @return ConvertHelper_ThrowableInfo |
|
| 246 | + */ |
|
| 247 | 247 | public function setFolderDepth(int $depth) : ConvertHelper_ThrowableInfo |
| 248 | 248 | { |
| 249 | 249 | return $this->setOption('folder-depth', $depth); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * Retrieves the current folder depth option value. |
|
| 254 | - * |
|
| 255 | - * @return int |
|
| 256 | - * @see ConvertHelper_ThrowableInfo::setFolderDepth() |
|
| 257 | - */ |
|
| 252 | + /** |
|
| 253 | + * Retrieves the current folder depth option value. |
|
| 254 | + * |
|
| 255 | + * @return int |
|
| 256 | + * @see ConvertHelper_ThrowableInfo::setFolderDepth() |
|
| 257 | + */ |
|
| 258 | 258 | public function getFolderDepth() : int |
| 259 | 259 | { |
| 260 | 260 | $depth = $this->getOption('folder-depth'); |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | return 2; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - /** |
|
| 269 | - * Retrieves all function calls that led to the error, |
|
| 270 | - * ordered from latest to earliest (the first one in |
|
| 271 | - * the stack is actually the last call). |
|
| 272 | - * |
|
| 273 | - * @return ConvertHelper_ThrowableInfo_Call[] |
|
| 274 | - */ |
|
| 268 | + /** |
|
| 269 | + * Retrieves all function calls that led to the error, |
|
| 270 | + * ordered from latest to earliest (the first one in |
|
| 271 | + * the stack is actually the last call). |
|
| 272 | + * |
|
| 273 | + * @return ConvertHelper_ThrowableInfo_Call[] |
|
| 274 | + */ |
|
| 275 | 275 | public function getCalls() |
| 276 | 276 | { |
| 277 | 277 | return $this->calls; |
@@ -287,10 +287,10 @@ discard block |
||
| 287 | 287 | return $this->calls[0]; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - /** |
|
| 291 | - * Returns the amount of function and method calls in the stack trace. |
|
| 292 | - * @return int |
|
| 293 | - */ |
|
| 290 | + /** |
|
| 291 | + * Returns the amount of function and method calls in the stack trace. |
|
| 292 | + * @return int |
|
| 293 | + */ |
|
| 294 | 294 | public function countCalls() : int |
| 295 | 295 | { |
| 296 | 296 | return $this->callsCount; |