Gregwar\RST\Parser::initDirective PHP Method

initDirective() protected method

.. |variable| name:: data :option: value :otherOption: otherValue
protected initDirective ( string $line ) : false
$line string
return false if this is not a directive, else an array containing : - variable: the variable name of the directive - name: the directive name - data: the data of the directive - options: an array of all the options and their values
    protected function initDirective($line)
    {
        if (preg_match('/^\\.\\. (\\|(.+)\\| |)([^\\s]+)::( (.*)|)$/mUsi', $line, $match)) {
            $this->directive = array('variable' => $match[2], 'name' => $match[3], 'data' => trim($match[4]), 'options' => array());
            return true;
        }
        return false;
    }