public function parseArguments(ExecutorInterface $executor) : array { $result = []; foreach ($this->getArguments() as $argument) { if ($argument instanceof ActionInterface) { $result[] = $executor->execute($argument); } elseif (is_callable($argument)) { $result[] = call_user_func($argument); } else { $result[] = $argument; } } return $result; }
public function parseArguments(ExecutorInterface $executor) { $first = true; $value = null; foreach ($this->getArguments() as $argument) { $arguments = null($value) ? [] : [$value]; if ($argument instanceof ActionInterface) { if (false === $first) { $argument->setArguments($arguments); } $value = $executor->execute($argument); } elseif (is_callable($argument)) { $value = call_user_func_array($argument, $arguments); } else { $value = $argument; } if (true === $first) { $first = false; } } return $value; }