Skip to content

Commit

Permalink
cs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SniperSister committed Jun 12, 2022
1 parent b416c8a commit 48f0b34
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions libraries/src/TUF/HttpFileFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ class HttpFileFetcher implements RepoFileFetcherInterface
* @param \Joomla\Http\Http $client The HTTP client.
* @param string $metadataPrefix The path prefix for metadata.
* @param string $targetsPrefix The path prefix for targets.
* @param string $baseUri Repo base uri for requests
*
* @since __DEPLOY_VERSION__
*/
public function __construct(Http $client, string $metadataPrefix, string $targetsPrefix, $baseUri)
public function __construct(Http $client, string $metadataPrefix, string $targetsPrefix, string $baseUri)
{
$this->client = $client;
$this->metadataPrefix = $metadataPrefix;
Expand All @@ -91,7 +92,7 @@ public static function createFromUri(
string $metadataPrefix = '/metadata/',
string $targetsPrefix = '/targets/'
): self {
$httpFactory = new HttpFactory();
$httpFactory = new HttpFactory;
$client = $httpFactory->getHttp([], 'curl');

return new static($client, $metadataPrefix, $targetsPrefix, $baseUri);
Expand All @@ -100,8 +101,8 @@ public static function createFromUri(
/**
* Fetches a metadata file from the remote repo.
*
* @param string $fileName The name of the metadata file to fetch.
* @param integer $maxBytes The maximum number of bytes to download.
* @param string $fileName The name of the metadata file to fetch.
* @param integer $maxBytes The maximum number of bytes to download.
*
* @return \GuzzleHttp\Promise\PromiseInterface A promise wrapping a StreamInterface instanfe
*/
Expand All @@ -113,8 +114,10 @@ public function fetchMetadata(string $fileName, int $maxBytes): PromiseInterface
/**
* Fetches a target file from the remote repo.
*
* @param array $options (optional) Additional request options to pass to the http client
* @param string $url An arbitrary URL from which the target should be downloaded.
* @param string $fileName The name of the target to fetch.
* @param integer $maxBytes The maximum number of bytes to download.
* @param array $options (optional) Additional request options to pass to the http client
* @param string $url An arbitrary URL from which the target should be downloaded.
*
* @return PromiseInterface
*
Expand All @@ -127,6 +130,7 @@ public function fetchTarget(
string $url = null
): PromiseInterface {
$location = $url ?: $this->targetsPrefix . $fileName;

return $this->fetchFile($location, $maxBytes, $options);
}

Expand All @@ -151,7 +155,7 @@ protected function fetchFile(string $url, int $maxBytes, array $options = []): P

if ($response->getStatusCode() === 404)
{
throw new RepoFileNotFound();
throw new RepoFileNotFound;
}

if ($response->getStatusCode() !== 200)
Expand Down

0 comments on commit 48f0b34

Please sign in to comment.