get section Parser
@param  string       $section
@param  bool|boolean $throwException
@return mixed
@throws \RuntimeException
332663
public function getParser(string $section, bool $throwException = false)
    {
        if (!self::$parsers) {
            self::$parsers = self::loadDefaultParsers();
        }

        if (isset(self::$parsers[$section])) {
            return self::$parsers[$section];
        }

        if ($throwException) {
            throw new \RuntimeException("The section($section) formatter is not registered!", -500);
        }

        return null;
    }
819575
public function findSection($section)
    {
        if (isset($this->sectionMap[$section])) {
            return $this->sectionMap[$section];
        }

        return false;
    }
612855
public function parseSections(array $sections, Configuration $configuration = null)
    {
        if (is_null($configuration)) {
            $configuration = new Configuration();
        }

        foreach ($sections as $sectionName => $section) {
            $name = explode(':', $sectionName, 2);

            $class = $configuration->findSection($name[0]);

            if (false === $class) {
                $class = 'Supervisor\Configuration\Section\GenericSection';
                $name[1] = $sectionName;
            }

            if (isset($name[1])) {
                $section = new $class($name[1], $section);
            } else {
                $section = new $class($section);
            }

            $configuration->addSection($section);
        }

        return $configuration;
    }
1141019
protected function processSection(array $section)
        {
            $config = array();

            foreach ($section as $key => $value) {
                $this->processKey($key, $value, $config);
            }

            return $config;
        }
678176
public function getManager($throwException = false)
    {
        $data = $this->query($throwException);

        return [
            'configuration' => $this->status->getStatus(),
            'actual'        => isset($data['manager']) ? TaskManagerStatus::STATUS_STARTED : TaskManagerStatus::STATUS_STOPPED,
            'process-id'    => isset($data['manager']) ? $data['manager']['process-id'] : null,
        ];
    }
265862
public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        $sectionCreate = $this->sectionService->newSectionCreateStruct();

        //@todo XSD says that name is not mandatory? Does that make sense?
        if (!array_key_exists('name', $data)) {
            throw new Exceptions\Parser("Missing 'name' attribute for SectionInput.");
        }

        $sectionCreate->name = $data['name'];

        //@todo XSD says that identifier is not mandatory? Does that make sense?
        if (!array_key_exists('identifier', $data)) {
            throw new Exceptions\Parser("Missing 'identifier' attribute for SectionInput.");
        }

        $sectionCreate->identifier = $data['identifier'];

        return $sectionCreate;
    }
1147366
public function get_section_info($sectionnumber, $strictness = IGNORE_MISSING) {
        if (!array_key_exists($sectionnumber, $this->sectioninfo)) {
            if ($strictness === MUST_EXIST) {
                throw new moodle_exception('sectionnotexist');
            } else {
                return null;
            }
        }
        return $this->sectioninfo[$sectionnumber];
    }
920222
public function setSection( Section$section=null ):self
	{
		if( !$section ){
			$this->sectionLevel= 0;
			$this->currentSection= null;

			return $this;
		}

		if( $this->currentSection ){
			$this->throw('Nesting definition of section is forbidden.');
		}

		if( isset($this->parent->sections[$section->name]) ){
			$this->throw("Section {$section->name} already defined.");
		}

		$this->currentSection= $section;

		if( $section->name ){
			$this->parent->sections[$section->name]=$section;
		}

		$this->sectionLevel= $this->level+1;

		return $this;
	}
870701
public function handleSection() {

        if ($ClassName = $this->owner->getRequest()->param('SECTIONNAME')) {
            $sections = $this->owner->data()->Sections();
            if ($section = $sections->filter(array('ClassName' => $ClassName))->first()) {
                if ($action = $this->owner->getRequest()->param('ACTION')) {
                    return $section->getController()->$action();
                }
            }
        }
        // return $section->getController();
    }
180997
private function getOption(string $element, string $section, $default = null)
    {
        if (!isset($this->config['declarations'][$element])) {
            throw new ScaffolderException("Undefined declaration '{$element}'.");
        }

        if (array_key_exists($section, $this->config['declarations'][$element])) {
            return $this->config['declarations'][$element][$section];
        }

        return $default;
    }
1340574
public function visitSection(SectionInterface $section)
    {

        $template = 'section/' . $section->getType() . '.twig';

        return $this
            ->loadTemplate($template)
            ->render(
                [
                    "id" => $section->getId(),
                    "classes" => $section->getClasses(),
                    "data" => $section->getData(),
                    "writables" => $section->getWritables(),
                ]
            );
    }
458012
public function parseSection($section, $breakChar = ' ') {
        $this->setTooManyClosingParenthesis(false);
        $inQuotes = false;
        $lastWasQuote = false;
        $doSetLastWasQuote = false;
        $quoteType = null;
        $parenthesisCount = 0;
        $buffer = '';
        $length = strlen($section);
        for($i = 0; $i < $length; $i++) {
            $char = $section[$i];
            if($inQuotes) {
                if($char == $quoteType) {
                    $inQuotes = false;
                    $doSetLastWasQuote = true;
                }
            } else {
                //Fix for double quotes to show a quote
                if($char == $quoteType && $lastWasQuote) {
                    $buffer .= $quoteType;
                    $inQuotes = true;
                } elseif($char == '"' || $char == '\'') {
                    $inQuotes = true;
                    $quoteType = $char;
                } elseif($char == $breakChar && $parenthesisCount == 0) {
                    return $buffer;
                } elseif($char == '(') {
                    $parenthesisCount++;
                } elseif($char == ')') {
                    $parenthesisCount--;
                    if($parenthesisCount == -1) {
                        $this->setTooManyClosingParenthesis(true);
                        return $buffer;
                    }
                }
            }
            $buffer .= $char;
            if($doSetLastWasQuote) {
                $doSetLastWasQuote = false;
                $lastWasQuote = true;
            } else {
                $lastWasQuote = false;
            }
        }
        return $buffer;
    }
135921
public function get($id, bool $throwException = true)
    {
        if (!$this->_container->has($id)) {
            if ($throwException) {
                throw new InvalidConfigException("Unknown component ID: $id");
            }
            return null;
        }

        return $this->_container->get($id);
    }
943322
public function getRawSection($section = null)
    {
        if (null === $section) {
            return $this->raw_parameters;
        } elseif (array_key_exists($section, $this->raw_parameters)) {
            return $this->raw_parameters[$section];
        }

        return;
    }
843292
public function get(string $section, string $key, $default = null)
    {
        return $this->cacheStore->get($section . $this->sectionKeyDelimiter . $key, $default);
    }
515858
public function getDescription( $throwException = TRUE )
	{
		$tags	= $this->getMetaTags( TRUE );
		if( isset( $tags['description'] ) )
			return $tags['description'];
		if( isset( $tags['dc.description'] ) )
			return $tags['dc.description'];
		if( $throwException )
			throw new RuntimeException( 'No Description Meta Tag set.' );
		return "";
	}
258521
public function getSectionComponents($sectionName)
    {
        return $this->getComponents()->filter(
            function (ComponentInterface $component) use ($sectionName) {
                return $component instanceof RenderableComponentInterface
                && $component->getRenderSection() === $sectionName;
            }
        );
    }