* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\CssSelector\XPath; /** * XPath expression translator interface. * * This component is a port of the Python cssselect library, * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. * * @author Jean-François Simon * * @internal */ class XPathExpr { private $path; private $element; private $condition; /** * @param string $path * @param string $element * @param string $condition * @param bool $starPrefix */ public function __construct($path = '', $element = '*', $condition = '', $starPrefix = false) { $this->path = $path; $this->element = $element; $this->condition = $condition; if ($starPrefix) { $this->addStarPrefix(); } } /** * @return string */ public function getElement() { return $this->element; } /** * @return $this */ public function addCondition($condition) { $this->condition = $this->condition ? sprintf('(%s) and (%s)', $this->condition, $condition) : $condition; return $this; } /** * @return string */ public function getCondition() { return $this->condition; } /** * @return $this */ public function addNameTest() { if ('*' !== $this->element) { $this->addCondition('name() = '.Translator::getXpathLiteral($this->element)); $this->element = '*'; } return $this; } /** * @return $this */ public function addStarPrefix() { $this->path .= '*/'; return $this; } /** * Joins another XPathExpr with a combiner. * * @param string $combiner * @param XPathExpr $expr * * @return $this */ public function join($combiner, self $expr) { $path = $this->__toString().$combiner; if ('*/' !== $expr->path) { $path .= $expr->path; } $this->path = $path; $this->element = $expr->element; $this->condition = $expr->condition; return $this; } /** * @return string */ public function __toString() { $path = $this->path.$this->element; $condition = null === $this->condition || '' === $this->condition ? '' : '['.$this->condition.']'; return $path.$condition; } } __halt_compiler();----SIGNATURE:----Xoc2bz349Q3rEvZjfO2DOSshPb5DU1RGaBZ1eF8CZ2smxXJUnySLedoWSjYCXdPN3iAbpR122V03LI2KZrTxctLGwAKf4blNTD7UDc0G8Fcqlrq1TOav530cyrK0VsBTYETdDX5hQduNT782gk8xxi3xBxov7RGTBOzGNfgMhPdW674CxO9J3Ll5epHIKQRY8Pr5Kjz9GqYE/19/rWwvINANtxfxHmBpOvl0h5L1NRB43/6OaHAHKd0/BPnR8Bmgr+QrHAr9OigE8gQ91ZRuTmpL/pJuPWtAbbfLHZj6JvcrcXVMyaw3Hlu3E/MJlF7f8NYTkehUEQPeeC0ix15iks60bXRjeG09MGj1/kcJjP1Nl5GMyMHjbT1d7lvx/W94KWe2pVGURwt8ue6whgcYztZ211WazIg3Fzb26xoqMY6eEvI0gLKmb72+UOvaJEG5ZBgKdVeDGT+5vJ4Ut2uSC7bbFabXvPfrkEJ/T+aecQ6E0NH0OTZ3uuhFwQ0kFz56L8xY8W4h5H1mQWPMmqdIf0LIX4/H22HtBjbFciNfzvuwEMiWNnoSKMG3T6fqAueALHPAEdc1TAPP4nDtXIdqM43DcEaXLeqUqei1jVHDeSX2CmFezB38m4T02WjjC0QDOEDu2jn2pLBtRFRVlWd4gj0LXwKoajTI1e8C8Gc6Y+8=----ATTACHMENT:----ODU5OTA3NTYxNzM1Mjg1OSA2NzQxNzgxODgzNDQwMjMwIDgyNjc2Njc4MTQ1NzU1OTM=