Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PseudoSelector.php

class PseudoSelector

Selector part selector pseudo class

@author Marco Marchiò <marco.mm89@gmail.com>

Hierarchy

  • class \Peast\Selector\Node\Part\Part
    • class \Peast\Selector\Node\Part\Pseudo extends \Peast\Selector\Node\Part\Part
      • class \Peast\Selector\Node\Part\PseudoSelector extends \Peast\Selector\Node\Part\Pseudo

Expanded class hierarchy of PseudoSelector

File

vendor/mck89/peast/lib/Peast/Selector/Node/Part/PseudoSelector.php, line 21

Namespace

Peast\Selector\Node\Part
View source
class PseudoSelector extends Pseudo {
    
    /**
     * Priority
     *
     * @var int
     */
    protected $priority = 1;
    
    /**
     * Selector
     *
     * @var Selector
     */
    protected $selector;
    
    /**
     * Sets the selector
     *
     * @param Selector $selector Selector
     *
     * @return $this
     */
    public function setSelector(Selector $selector) {
        $this->selector = $selector;
        return $this;
    }
    
    /**
     * Returns true if the selector part matches the given node,
     * false otherwise
     *
     * @param Node $node    Node
     * @param Node $parent  Parent node
     *
     * @return bool
     */
    public function check(Node $node, $parent = null) {
        $match = new Matches();
        $match->addMatch($node, $parent);
        $res = $this->selector
            ->exec($match)
            ->count();
        return $this->name === "not" ? $res === 0 : $res !== 0;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
Part::getPriority public function
Pseudo::$name protected property Selector name
Pseudo::setName public function Sets the name
PseudoSelector::$priority protected property Priority Overrides Part::$priority
PseudoSelector::$selector protected property Selector
PseudoSelector::check public function Returns true if the selector part matches the given node,
false otherwise
Overrides Part::check
PseudoSelector::setSelector public function Sets the selector

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal