DiDom\Query::parseProperty PHP Method

parseProperty() protected static method

protected static parseProperty ( string $property ) : array
$property string
return array
    protected static function parseProperty($property)
    {
        $name = '(?P<name>[\\w\\-]*)';
        $args = '(?:\\((?P<args>[^\\)]+)\\))';
        $regexp = '/(?:' . $name . $args . '?)?/is';
        if (preg_match($regexp, $property, $segments)) {
            $result = [];
            $result['name'] = $segments['name'];
            $result['args'] = isset($segments['args']) ? explode('|', $segments['args']) : [];
            return $result;
        }
        throw new RuntimeException('Invalid selector');
    }