/** * Make path from this path as context path and type and value as new directive value * @param $type * @param $value * @return DirectivePath */ public function makeChildDirectivePath($type, $value) { $type = Directive::reservedWordFlagRemover($type); $path = $this->getPath(); if ($this->isRoot()) { $path = ["directive" => $type, "value" => $value]; } else { $inner =& $path; while (!$this->isLastDirectiveInPath($inner)) { $inner =& $inner["innerDirective"]; } $inner["innerDirective"] = ["directive" => $type, "value" => $value]; } return new DirectivePath($path); }
/** * if directive founded in available, return it name as it set there, * else return its in lowerCase * format directiveName to format that set in * @param String $directiveName * @return string */ protected function formatDirectiveName($directiveName) { $formattedDirectiveName = Directive::reservedWordFlagRemover(strtolower($directiveName)); if (array_key_exists($formattedDirectiveName, $this->availableList)) { $directiveName = $this->availableList[$formattedDirectiveName]; } if (in_array($formattedDirectiveName, Directive::$reservedWordDirectives)) { $directiveName = Directive::reservedWordFlagRemover($directiveName); } return $directiveName; }
/** * @param String $type * @param String $value * @param Boolean $isSection * @param iContext $context * @throws \LTDBeget\apacheConfigurator\exceptions\NotAllowedContextException * @throws \LTDBeget\apacheConfigurator\exceptions\NotAllowedValueException */ public function __construct($type, $value, $isSection, iContext $context) { $this->type = $type; $this->isSection = $isSection; parent::__construct($value, $context); }