for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace RulerZ\Executor\ArrayTarget;
use RulerZ\Context\ExecutionContext;
use RulerZ\Context\ObjectContext;
use RulerZ\Result\IteratorTools;
trait FilterTrait
{
abstract protected function execute($target, array $operators, array $parameters);
/**
* {@inheritdoc}
*/
public function applyFilter($target, array $parameters, array $operators, ExecutionContext $context)
$target
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$parameters
$operators
$context
throw new \LogicException('Not supported.');
}
public function filter($target, array $parameters, array $operators, ExecutionContext $context)
return IteratorTools::fromGenerator(function () use ($target, $parameters, $operators) {
foreach ($target as $row) {
$targetRow = is_array($row) ? $row : new ObjectContext($row);
if ($this->execute($targetRow, $operators, $parameters)) {
yield $row;
});
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.