Replace IHTTPResult for CurlResult usages

This commit is contained in:
Philipp
2020-10-07 21:49:12 +02:00
parent f238f4efbe
commit 97167d7b90
4 changed files with 24 additions and 23 deletions
+7 -6
View File
@@ -30,7 +30,7 @@ use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Module\Register;
use Friendica\Network\CurlResult;
use Friendica\Network\IHTTPResult;
use Friendica\Protocol\Diaspora;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
@@ -630,18 +630,19 @@ class GServer
/**
* Detect server type by using the nodeinfo data
*
* @param string $url address of the server
* @param CurlResult $curlResult
* @param string $url address of the server
* @param IHTTPResult $httpResult
*
* @return array Server data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function fetchNodeinfo(string $url, CurlResult $curlResult)
private static function fetchNodeinfo(string $url, IHTTPResult $httpResult)
{
if (!$curlResult->isSuccess()) {
if (!$httpResult->isSuccess()) {
return [];
}
$nodeinfo = json_decode($curlResult->getBody(), true);
$nodeinfo = json_decode($httpResult->getBody(), true);
if (!is_array($nodeinfo) || empty($nodeinfo['links'])) {
return [];
+1 -1
View File
@@ -101,7 +101,7 @@ class CurlResult implements IHTTPResult
*
* @param string $url optional URL
*
* @return CurlResult a CURL with error response
* @return IHTTPResult a CURL with error response
* @throws InternalServerErrorException
*/
public static function createErrorCurl($url = '')
+3 -3
View File
@@ -57,7 +57,7 @@ interface IHTTPRequest
* @param string $accept_content supply Accept: header with 'accept_content' as the value
* @param string $cookiejar Path to cookie jar file
*
* @return CurlResult With all relevant information, 'body' contains the actual fetched content.
* @return IHTTPResult With all relevant information, 'body' contains the actual fetched content.
*/
public function fetchFull(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '');
@@ -76,7 +76,7 @@ interface IHTTPRequest
* 'cookiejar' => path to cookie jar file
* 'header' => header array
*
* @return CurlResult
* @return IHTTPResult
*/
public function get(string $url, bool $binary = false, array $opts = []);
@@ -88,7 +88,7 @@ interface IHTTPRequest
* @param array $headers HTTP headers
* @param int $timeout The timeout in seconds, default system config value or 60 seconds
*
* @return CurlResult The content
* @return IHTTPResult The content
*/
public function post(string $url, $params, array $headers = [], int $timeout = 0);