public static function fromDirective(Directive $directive) { $results = new static(); foreach ($directive->getChildScope()->getDirectives() as $subDirective) { $results[$subDirective->getName()] = $subDirective->getValue(); } return $results; }
/** * Set parent directive for this Scope. * * Sets parent directive for this Scope and also * sets the $parentDirective->setChildScope($this) * * @param Directive $parentDirective * @return $this */ public function setParentDirective(Directive $parentDirective) { $this->parentDirective = $parentDirective; if ($parentDirective->getChildScope() !== $this) { $parentDirective->setChildScope($this); } return $this; }