1919use Symfony \Component \CssSelector \XPath \Translator ;
2020
2121/**
22- * @author Christophe Coevoet <stof@notk.org>
22+ * Converter is the main entry point of the component and can convert CSS
23+ * selectors to XPath expressions.
24+ *
25+ * This component is a port of the Python cssselect library,
26+ * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
27+ *
28+ * Copyright (c) 2007-2012 Ian Bicking and contributors. See AUTHORS
29+ * for more details.
30+ *
31+ * All rights reserved.
32+ *
33+ * Redistribution and use in source and binary forms, with or without
34+ * modification, are permitted provided that the following conditions are
35+ * met:
2336 *
24- * @api
37+ * 1. Redistributions of source code must retain the above copyright
38+ * notice, this list of conditions and the following disclaimer.
39+ *
40+ * 2. Redistributions in binary form must reproduce the above copyright
41+ * notice, this list of conditions and the following disclaimer in
42+ * the documentation and/or other materials provided with the
43+ * distribution.
44+ *
45+ * 3. Neither the name of Ian Bicking nor the names of its contributors may
46+ * be used to endorse or promote products derived from this software
47+ * without specific prior written permission.
48+ *
49+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
52+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IAN BICKING OR
53+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
54+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
55+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
56+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
57+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
58+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
59+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60+ *
61+ * @author Christophe Coevoet <stof@notk.org>
2562 */
26- class Converterimplements ConverterInterface
63+ class Converter
2764{
2865private $ translator ;
2966
@@ -47,7 +84,15 @@ public function __construct($html = true)
4784 }
4885
4986/**
50- * {@inheritdoc}
87+ * Translates a CSS expression to its XPath equivalent.
88+ *
89+ * Optionally, a prefix can be added to the resulting XPath
90+ * expression with the $prefix parameter.
91+ *
92+ * @param string $cssExpr The CSS expression.
93+ * @param string $prefix An optional prefix for the XPath expression.
94+ *
95+ * @return string
5196 */
5297public function toXPath ($ cssExpr ,$ prefix ='descendant-or-self:: ' )
5398 {