for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Nayjest\Querying\Handler\PostProcess;
use Nayjest\Querying\Handler\AbstractHandler;
use Nayjest\Querying\Handler\Priority;
use Nayjest\Querying\Operation\AddFieldOperation;
use Nayjest\Querying\Row\RowInterface;
class AddFieldHandler extends AbstractHandler
{
const PRIORITY = Priority::INITIALIZE_ROWS - 1;
public function getPriority()
return self::PRIORITY;
}
/**
* Applies operation to source and returns modified source.
*
*/
public function apply($dataSource)
/** @var AddFieldOperation $operation */
$operation = $this->operation;
foreach ($dataSource as $row) {
/** @var RowInterface $row */
$row->dynamicFieldsRegistry()->add(
$operation->getFieldName(),
$operation->getCallable()
);
return $dataSource;