Skip to content

Commit

Permalink
chore: fix for ArrayIterator usage
Browse files Browse the repository at this point in the history
  • Loading branch information
tlayh committed Feb 19, 2024
1 parent 1cb94b4 commit c85937f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
15 changes: 8 additions & 7 deletions Classes/Content/Scraper/Chain.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
namespace Aoe\Asdis\Content\Scraper;

use Aoe\Asdis\Domain\Model\Asset\Collection;
use ArrayIterator;

/**
* Scraper which chains other scrapers.
*/
class Chain extends \ArrayIterator implements ScraperInterface
class Chain extends ArrayIterator implements ScraperInterface
{
/**
* Needs to be called due to an extbase bug.
Expand All @@ -19,20 +20,20 @@ public function __construct()
}

/**
* @param ScraperInterface $scraper
* @param ScraperInterface $value
*/
public function append($scraper)
public function append($value): void
{
parent::append($scraper);
parent::append($value);
}

public function scrape(string $content): Collection
{
$assetCollection = new Collection();
$assetColection = new Collection();
foreach ($this as $scraper) {
/** @var ScraperInterface $scraper */
$assetCollection->merge($scraper->scrape($content));
$assetColection->merge($scraper->scrape($content));
}
return $assetCollection;
return $assetColection;
}
}
5 changes: 3 additions & 2 deletions Classes/Domain/Model/Asset/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
use Aoe\Asdis\Content\Replacement\Map;
use Aoe\Asdis\Domain\Model\Asset;
use Aoe\Asdis\Domain\Model\Asset\Collection as AssetCollection;
use ArrayIterator;

/**
* Collection which contains asset objects.
*/
class Collection extends \ArrayIterator
class Collection extends ArrayIterator
{
private array $elementHashes = [];

Expand All @@ -25,7 +26,7 @@ public function __construct()
/**
* @param Asset $asset
*/
public function append($asset)
public function append($asset): void
{
$elementHash = $asset->getHash();
$found = array_search($elementHash, $this->elementHashes);
Expand Down
5 changes: 3 additions & 2 deletions Classes/Domain/Model/Server/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
namespace Aoe\Asdis\Domain\Model\Server;

use Aoe\Asdis\Domain\Model\Server;
use ArrayIterator;

/**
* Collection which contains server objects.
*/
class Collection extends \ArrayIterator
class Collection extends ArrayIterator
{
/**
* Needs to be called due to an extbase bug.
Expand All @@ -21,7 +22,7 @@ public function __construct()
/**
* @param Server $server
*/
public function append($server)
public function append($server): void
{
parent::append($server);
}
Expand Down
6 changes: 4 additions & 2 deletions Classes/System/Uri/Filter/Chain.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

namespace Aoe\Asdis\System\Uri\Filter;

use ArrayIterator;

/**
* Chain of filters.
*/
class Chain extends \ArrayIterator implements FilterInterface
class Chain extends ArrayIterator implements FilterInterface
{
/**
* Needs to be called due to an extbase bug.
Expand All @@ -19,7 +21,7 @@ public function __construct()
/**
* @param FilterInterface $filter
*/
public function append($filter)
public function append($filter): void
{
parent::append($filter);
}
Expand Down

0 comments on commit c85937f

Please sign in to comment.