/** * Find in context inner directive with identical name and value * @param $directiveName * @param $value * @param iContext $context * @return iDirective|null if exists return it or return null */ protected function getInnerDirectiveIfExists($directiveName, $value, iContext $context) { foreach ($context->getInnerDirectives() as $innerDirective) { if ($innerDirective->getName() == $directiveName and $innerDirective->getValue() == $value) { return $innerDirective; } } return null; }
/** * Check current directive context on allowed (in what context this directive can be placed) * @param iContext $context * @return bool */ protected function isAllowedContext(iContext $context) { if ($context->getFullName() == Unknown::getFullName()) { return true; } return is_null($this->allowedContext) ? true : in_array($context->getName(), $this->allowedContext); }