Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/css-selector/XPath/Translator.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
28 * | 28 * |
29 * @internal | 29 * @internal |
30 */ | 30 */ |
31 class Translator implements TranslatorInterface | 31 class Translator implements TranslatorInterface |
32 { | 32 { |
33 /** | |
34 * @var ParserInterface | |
35 */ | |
36 private $mainParser; | 33 private $mainParser; |
37 | 34 |
38 /** | 35 /** |
39 * @var ParserInterface[] | 36 * @var ParserInterface[] |
40 */ | 37 */ |
41 private $shortcutParsers = array(); | 38 private $shortcutParsers = array(); |
42 | 39 |
43 /** | 40 /** |
44 * @var Extension\ExtensionInterface | 41 * @var Extension\ExtensionInterface[] |
45 */ | 42 */ |
46 private $extensions = array(); | 43 private $extensions = array(); |
47 | 44 |
48 /** | |
49 * @var array | |
50 */ | |
51 private $nodeTranslators = array(); | 45 private $nodeTranslators = array(); |
52 | |
53 /** | |
54 * @var array | |
55 */ | |
56 private $combinationTranslators = array(); | 46 private $combinationTranslators = array(); |
57 | |
58 /** | |
59 * @var array | |
60 */ | |
61 private $functionTranslators = array(); | 47 private $functionTranslators = array(); |
62 | |
63 /** | |
64 * @var array | |
65 */ | |
66 private $pseudoClassTranslators = array(); | 48 private $pseudoClassTranslators = array(); |
67 | |
68 /** | |
69 * @var array | |
70 */ | |
71 private $attributeMatchingTranslators = array(); | 49 private $attributeMatchingTranslators = array(); |
72 | 50 |
73 public function __construct(ParserInterface $parser = null) | 51 public function __construct(ParserInterface $parser = null) |
74 { | 52 { |
75 $this->mainParser = $parser ?: new Parser(); | 53 $this->mainParser = $parser ?: new Parser(); |
142 } | 120 } |
143 | 121 |
144 /** | 122 /** |
145 * Registers an extension. | 123 * Registers an extension. |
146 * | 124 * |
147 * @param Extension\ExtensionInterface $extension | |
148 * | |
149 * @return $this | 125 * @return $this |
150 */ | 126 */ |
151 public function registerExtension(Extension\ExtensionInterface $extension) | 127 public function registerExtension(Extension\ExtensionInterface $extension) |
152 { | 128 { |
153 $this->extensions[$extension->getName()] = $extension; | 129 $this->extensions[$extension->getName()] = $extension; |
178 } | 154 } |
179 | 155 |
180 /** | 156 /** |
181 * Registers a shortcut parser. | 157 * Registers a shortcut parser. |
182 * | 158 * |
183 * @param ParserInterface $shortcut | |
184 * | |
185 * @return $this | 159 * @return $this |
186 */ | 160 */ |
187 public function registerParserShortcut(ParserInterface $shortcut) | 161 public function registerParserShortcut(ParserInterface $shortcut) |
188 { | 162 { |
189 $this->shortcutParsers[] = $shortcut; | 163 $this->shortcutParsers[] = $shortcut; |
190 | 164 |
191 return $this; | 165 return $this; |
192 } | 166 } |
193 | 167 |
194 /** | 168 /** |
195 * @param NodeInterface $node | |
196 * | |
197 * @return XPathExpr | 169 * @return XPathExpr |
198 * | 170 * |
199 * @throws ExpressionErrorException | 171 * @throws ExpressionErrorException |
200 */ | 172 */ |
201 public function nodeToXPath(NodeInterface $node) | 173 public function nodeToXPath(NodeInterface $node) |
224 | 196 |
225 return call_user_func($this->combinationTranslators[$combiner], $this->nodeToXPath($xpath), $this->nodeToXPath($combinedXpath)); | 197 return call_user_func($this->combinationTranslators[$combiner], $this->nodeToXPath($xpath), $this->nodeToXPath($combinedXpath)); |
226 } | 198 } |
227 | 199 |
228 /** | 200 /** |
229 * @param XPathExpr $xpath | |
230 * @param FunctionNode $function | |
231 * | |
232 * @return XPathExpr | 201 * @return XPathExpr |
233 * | 202 * |
234 * @throws ExpressionErrorException | 203 * @throws ExpressionErrorException |
235 */ | 204 */ |
236 public function addFunction(XPathExpr $xpath, FunctionNode $function) | 205 public function addFunction(XPathExpr $xpath, FunctionNode $function) |