/** * Returns all available definitions for a specific environment. * * @param Environment $environment * * @return Definition[] * * @throws RedundantStepException */ public function getEnvironmentDefinitions(Environment $environment) { $patterns = array(); $definitions = array(); foreach ($this->environmentManager->readEnvironmentCallees($environment) as $callee) { if (!$callee instanceof Definition) { continue; } $pattern = $callee->getPattern(); if (isset($patterns[$pattern])) { throw new RedundantStepException($callee, $patterns[$pattern]); } $patterns[$pattern] = $callee; $definitions[] = $callee; } return $definitions; }
/** * Returns all available hooks for a specific environment. * * @param Environment $environment * * @return Hook[] */ public function getEnvironmentHooks(Environment $environment) { return array_filter($this->environmentManager->readEnvironmentCallees($environment), function (Callee $callee) { return $callee instanceof Hook; }); }