Gregwar\RST\Parser::getCurrentDirective PHP Method

getCurrentDirective() protected method

Gets the current directive
protected getCurrentDirective ( ) : Gregwar\RST\Directive
return Gregwar\RST\Directive
    protected function getCurrentDirective()
    {
        if (!$this->directive) {
            $this->getEnvironment()->getErrorManager()->error('Asking for current directive, but there is not');
        }
        $name = $this->directive['name'];
        if (isset($this->directives[$name])) {
            return $this->directives[$name];
        } else {
            $message = 'Unknown directive: ' . $name;
            $message .= ' in ' . $this->getFilename() . ' line ' . $this->getCurrentLine();
            $this->getEnvironment()->getErrorManager()->error($message);
            return null;
        }
    }