DiDom\Query::convertProperty PHP Method

convertProperty() protected static method

protected static convertProperty ( string $name, array $args = [] ) : string
$name string
$args array
return string
    protected static function convertProperty($name, $args = [])
    {
        if ($name === 'text') {
            return 'text()';
        }
        if ($name === 'attr') {
            $attributes = [];
            foreach ($args as $attribute) {
                $attributes[] = sprintf('name() = "%s"', $attribute);
            }
            return sprintf('@*[%s]', implode(' or ', $attributes));
        }
        throw new RuntimeException('Invalid selector: unknown property type');
    }