/**
  * detach innerDirective from iInnerDirectiveAble
  * @param iDirective $directive
  * @throws NotAllowedContextException
  */
 public function detachInnerDirective(iDirective $directive)
 {
     if ($this !== $directive->getContext()) {
         throw new NotAllowedContextException("Trying to detach from {$this->getName()} directive {$directive->getContext()} which is not its context");
     }
     foreach ($this->innerDirectives as $key => $innerDirective) {
         if ($directive === $innerDirective) {
             unset($this->innerDirectives[$key]);
         }
     }
 }
Пример #2
0
 /**
  * add InnerDirective in iInnerDirectiveAble
  * @param iDirective $directive
  * @throws NotAllowedContextException
  */
 public function appendInnedDirective(iDirective $directive)
 {
     if ($directive->getContext() !== $this) {
         throw new NotAllowedContextException("trying add inner directive in {$this->getName()} with context of another directive");
     }
     $this->innerDirectives[] = $directive;
 }