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;
        }
    }