TranslatorInterface.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\CssSelector\XPath;
  11. use Symfony\Component\CssSelector\Node\SelectorNode;
  12. /**
  13. * XPath expression translator interface.
  14. *
  15. * This component is a port of the Python cssselect library,
  16. * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
  17. *
  18. * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
  19. *
  20. * @internal
  21. */
  22. interface TranslatorInterface
  23. {
  24. /**
  25. * Translates a CSS selector to an XPath expression.
  26. *
  27. * @param string $cssExpr
  28. * @param string $prefix
  29. *
  30. * @return string
  31. */
  32. public function cssToXPath($cssExpr, $prefix = 'descendant-or-self::');
  33. /**
  34. * Translates a parsed selector node to an XPath expression.
  35. *
  36. * @param SelectorNode $selector
  37. * @param string $prefix
  38. *
  39. * @return string
  40. */
  41. public function selectorToXPath(SelectorNode $selector, $prefix = 'descendant-or-self::');
  42. }