vendor/jackalope/jackalope/src/Jackalope/Query/QOM/DescendantNodeConstraint.php line 36

  1. <?php
  2. namespace Jackalope\Query\QOM;
  3. use InvalidArgumentException;
  4. use PHPCR\Query\QOM\DescendantNodeInterface;
  5. /**
  6.  * {@inheritDoc}
  7.  *
  8.  * @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
  9.  * @license http://opensource.org/licenses/MIT MIT License
  10.  *
  11.  * @api
  12.  */
  13. class DescendantNodeConstraint implements DescendantNodeInterface
  14. {
  15.     /**
  16.      * @var string
  17.      */
  18.     protected $selectorName;
  19.     /**
  20.      * @var string
  21.      */
  22.     protected $ancestorPath;
  23.     /**
  24.      * Constructor
  25.      *
  26.      * @param string $selectorName
  27.      * @param string $path
  28.      *
  29.      * @throws InvalidArgumentException
  30.      */
  31.     public function __construct($selectorName$path)
  32.     {
  33.         if (null === $selectorName) {
  34.             throw new InvalidArgumentException('Required argument selectorName may not be null.');
  35.         }
  36.         $this->selectorName $selectorName;
  37.         $this->path $path;
  38.     }
  39.     /**
  40.      * {@inheritDoc}
  41.      *
  42.      * @api
  43.      */
  44.     public function getSelectorName()
  45.     {
  46.         return $this->selectorName;
  47.     }
  48.     /**
  49.      * {@inheritDoc}
  50.      *
  51.      * @api
  52.      */
  53.     public function getAncestorPath()
  54.     {
  55.         return $this->path;
  56.     }
  57.     /**
  58.      * Gets all constraints including itself
  59.      *
  60.      * @return array the constraints
  61.      *
  62.      * @api
  63.      */
  64.     public function getConstraints()
  65.     {
  66.         return [$this];
  67.     }
  68. }