X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2FCurlResult.php;h=017f2c559f944ae10fa500dff30d3fbaaac3131d;hb=befc2af5043a3afde251721c0d27df695db1bb7e;hp=b0e801010d4ea0615f749feb3f50f355cee5d653;hpb=2e8ad098b9917dca48889c6bb36e167596e475a7;p=friendica.git diff --git a/src/Network/CurlResult.php b/src/Network/CurlResult.php index b0e801010d..017f2c559f 100644 --- a/src/Network/CurlResult.php +++ b/src/Network/CurlResult.php @@ -1,6 +1,6 @@ returnCode; } - /** {@inheritDoc} */ + /** + * Returns the Curl Content Type + * + * @return string the Curl Content Type + */ public function getContentType() { return $this->contentType; } - /** {@inheritDoc} */ - public function getHeader($header) + /** + * Returns the Curl headers + * + * @param string $field optional header field. Return all fields if empty + * + * @return string the Curl headers or the specified content of the header variable + */ + public function getHeader(string $field = '') { - if (empty($header)) { - return ''; + if (empty($field)) { + return $this->header; } - $header = strtolower(trim($header)); + $field = strtolower(trim($field)); $headers = $this->getHeaderArray(); - if (isset($headers[$header])) { - return $headers[$header]; + if (isset($headers[$field])) { + return $headers[$field]; } return ''; } - /** {@inheritDoc} */ - public function getHeaders() - { - return $this->getHeaderArray(); - } - - /** {@inheritDoc} */ + /** + * Check if a specified header exists + * + * @param string $field header field + * + * @return boolean "true" if header exists + */ public function inHeader(string $field) { $field = strtolower(trim($field)); @@ -275,7 +289,11 @@ class CurlResult implements IHTTPResult return array_key_exists($field, $headers); } - /** {@inheritDoc} */ + /** + * Returns the Curl headers as an associated array + * + * @return array associated header array + */ public function getHeaderArray() { if (!empty($this->header_fields)) { @@ -295,55 +313,73 @@ class CurlResult implements IHTTPResult return $this->header_fields; } - /** {@inheritDoc} */ + /** + * @return bool + */ public function isSuccess() { return $this->isSuccess; } - /** {@inheritDoc} */ + /** + * @return string + */ public function getUrl() { return $this->url; } - /** {@inheritDoc} */ + /** + * @return string + */ public function getRedirectUrl() { return $this->redirectUrl; } - /** {@inheritDoc} */ + /** + * @return string + */ public function getBody() { return $this->body; } - /** {@inheritDoc} */ + /** + * @return array + */ public function getInfo() { return $this->info; } - /** {@inheritDoc} */ + /** + * @return bool + */ public function isRedirectUrl() { return $this->isRedirectUrl; } - /** {@inheritDoc} */ + /** + * @return int + */ public function getErrorNumber() { return $this->errorNumber; } - /** {@inheritDoc} */ + /** + * @return string + */ public function getError() { return $this->error; } - /** {@inheritDoc} */ + /** + * @return bool + */ public function isTimeout() { return $this->isTimeout;