Revert "Introduce IHTTPResult Interface as abstraction for CurlResult"
authorPhilipp <admin@philipp.info>
Sun, 11 Oct 2020 21:26:22 +0000 (23:26 +0200)
committerPhilipp <admin@philipp.info>
Sun, 11 Oct 2020 21:26:22 +0000 (23:26 +0200)
This reverts commit f238f4ef

src/Network/CurlResult.php
src/Network/IHTTPResult.php [deleted file]

index 072ab15..9f52edf 100644 (file)
@@ -29,7 +29,7 @@ use Friendica\Util\Network;
 /**
  * A content class for Curl call results
  */
-class CurlResult implements IHTTPResult
+class CurlResult
 {
        /**
         * @var int HTTP return code or 0 if timeout or failure
@@ -229,19 +229,33 @@ class CurlResult implements IHTTPResult
                }
        }
 
-       /** {@inheritDoc} */
+       /**
+        * Gets the Curl Code
+        *
+        * @return string The Curl Code
+        */
        public function getReturnCode()
        {
                return $this->returnCode;
        }
 
-       /** {@inheritDoc} */
+       /**
+        * Returns the Curl Content Type
+        *
+        * @return string the Curl Content Type
+        */
        public function getContentType()
        {
                return $this->contentType;
        }
 
-       /** {@inheritDoc} */
+       /**
+        * 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($field)) {
@@ -259,7 +273,13 @@ class CurlResult implements IHTTPResult
                return '';
        }
 
-       /** {@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));
@@ -269,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)) {
@@ -289,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;
diff --git a/src/Network/IHTTPResult.php b/src/Network/IHTTPResult.php
deleted file mode 100644 (file)
index be190c8..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-
-namespace Friendica\Network;
-
-/**
- * Temporary class to map Friendica used variables based on PSR-7 HTTPResponse
- */
-interface IHTTPResult
-{
-       /**
-        * Gets the Return Code
-        *
-        * @return string The Return Code
-        */
-       public function getReturnCode();
-
-       /**
-        * Returns the Content Type
-        *
-        * @return string the Content Type
-        */
-       public function getContentType();
-
-       /**
-        * Returns the headers
-        *
-        * @param string $field optional header field. Return all fields if empty
-        *
-        * @return string the headers or the specified content of the header variable
-        */
-       public function getHeader(string $field = '');
-
-       /**
-        * Check if a specified header exists
-        *
-        * @param string $field header field
-        *
-        * @return boolean "true" if header exists
-        */
-       public function inHeader(string $field);
-
-       /**
-        * Returns the headers as an associated array
-        *
-        * @return array associated header array
-        */
-       public function getHeaderArray();
-
-       /**
-        * @return bool
-        */
-       public function isSuccess();
-
-       /**
-        * @return string
-        */
-       public function getUrl();
-
-       /**
-        * @return string
-        */
-       public function getRedirectUrl();
-
-       /**
-        * @return string
-        */
-       public function getBody();
-
-       /**
-        * @return array
-        */
-       public function getInfo();
-
-       /**
-        * @return boolean
-        */
-       public function isRedirectUrl();
-
-       /**
-        * @return integer
-        */
-       public function getErrorNumber();
-
-       /**
-        * @return string
-        */
-       public function getError();
-
-       /**
-        * @return boolean
-        */
-       public function isTimeout();
-}