]> git.mxchange.org Git - friendica.git/commitdiff
Add constructor injection for ExternalResource
authorPhilipp <admin@philipp.info>
Fri, 25 Jun 2021 18:13:50 +0000 (20:13 +0200)
committerPhilipp <admin@philipp.info>
Fri, 25 Jun 2021 18:13:50 +0000 (20:13 +0200)
src/Model/Storage/ExternalResource.php

index 9c57e3990bbfe940301ab3619c465bdb54f51caf..8d1aded1516bbe7834a423933fafe4c659e55c29 100644 (file)
@@ -22,7 +22,7 @@
 namespace Friendica\Model\Storage;
 
 use BadMethodCallException;
-use Friendica\DI;
+use Friendica\Network\IHTTPRequest;
 
 /**
  * External resource storage class
@@ -34,6 +34,14 @@ class ExternalResource implements IStorage
 {
        const NAME = 'ExternalResource';
 
+       /** @var IHTTPRequest */
+       private $httpRequest;
+
+       public function __construct(IHTTPRequest $httpRequest)
+       {
+               $this->httpRequest = $httpRequest;
+       }
+
        /**
         * @inheritDoc
         */
@@ -44,7 +52,7 @@ class ExternalResource implements IStorage
                        return "";
                }
 
-               $curlResult = DI::httpRequest()->get($filename);
+               $curlResult = $this->httpRequest->get($filename);
                if ($curlResult->isSuccess()) {
                        return $curlResult->getBody();
                } else {