Add constructor injection for ExternalResource
This commit is contained in:
parent
3ece803816
commit
f1f3fa7216
|
@ -22,7 +22,7 @@
|
||||||
namespace Friendica\Model\Storage;
|
namespace Friendica\Model\Storage;
|
||||||
|
|
||||||
use BadMethodCallException;
|
use BadMethodCallException;
|
||||||
use Friendica\DI;
|
use Friendica\Network\IHTTPRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* External resource storage class
|
* External resource storage class
|
||||||
|
@ -34,6 +34,14 @@ class ExternalResource implements IStorage
|
||||||
{
|
{
|
||||||
const NAME = 'ExternalResource';
|
const NAME = 'ExternalResource';
|
||||||
|
|
||||||
|
/** @var IHTTPRequest */
|
||||||
|
private $httpRequest;
|
||||||
|
|
||||||
|
public function __construct(IHTTPRequest $httpRequest)
|
||||||
|
{
|
||||||
|
$this->httpRequest = $httpRequest;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
@ -44,7 +52,7 @@ class ExternalResource implements IStorage
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$curlResult = DI::httpRequest()->get($filename);
|
$curlResult = $this->httpRequest->get($filename);
|
||||||
if ($curlResult->isSuccess()) {
|
if ($curlResult->isSuccess()) {
|
||||||
return $curlResult->getBody();
|
return $curlResult->getBody();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue