Skip to content

Commit

Permalink
updates per reviews from @dbu and @franmomu
Browse files Browse the repository at this point in the history
  • Loading branch information
robfrawley committed Nov 25, 2021
1 parent 58902a8 commit ac371a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/Binary/Loader/ChainLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public function find($path)
{
$exceptions = [];

foreach ($this->loaders as $configName => $objectInst) {
foreach ($this->loaders as $configName => $loader) {
try {
return $objectInst->find($path);
return $loader->find($path);
} catch (NotLoadableException $loaderException) {
$exceptions[] = new ChainAttemptNotLoadableException($configName, $objectInst, $loaderException);
$exceptions[] = new ChainAttemptNotLoadableException($configName, $loader, $loaderException);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/Exception/Binary/Loader/ChainAttemptNotLoadableException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@

use Liip\ImagineBundle\Binary\Loader\LoaderInterface;

class ChainAttemptNotLoadableException extends NotLoadableException
final class ChainAttemptNotLoadableException extends NotLoadableException
{
private string $configName;
private LoaderInterface $objectInst;
private string $configName;
private LoaderInterface $loaderInst;

public function __construct(string $configName, LoaderInterface $objectInst, NotLoadableException $loaderException)
public function __construct(string $configName, LoaderInterface $loaderInst, NotLoadableException $loaderException)
{
$this->configName = $configName;
$this->objectInst = $objectInst;
$this->loaderInst = $loaderInst;

parent::__construct($this->compileFailureText(), 0, $loaderException);
}
Expand All @@ -33,7 +33,7 @@ public function getLoaderConfigName(): string

public function getLoaderObjectInst(): LoaderInterface
{
return $this->objectInst;
return $this->loaderInst;
}

public function getLoaderObjectName(): string
Expand Down
6 changes: 3 additions & 3 deletions src/Exception/Binary/Loader/ChainNotLoadableException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Liip\ImagineBundle\Exception\Binary\Loader;

class ChainNotLoadableException extends NotLoadableException
final class ChainNotLoadableException extends NotLoadableException
{
public function __construct(string $path, ChainAttemptNotLoadableException ...$exceptions)
{
Expand Down Expand Up @@ -39,8 +39,8 @@ private static function compileLoaderErrorsList(ChainAttemptNotLoadableException
}, ...$exceptions);
}

private static function implodeArrayMappedExceptions(\Closure $listMapper, ChainAttemptNotLoadableException ...$exceptions): string
private static function implodeArrayMappedExceptions(\Closure $mapper, ChainAttemptNotLoadableException ...$exceptions): string
{
return implode(', ', array_map($listMapper, $exceptions));
return implode(', ', array_map($mapper, $exceptions));
}
}

0 comments on commit ac371a7

Please sign in to comment.