comparison vendor/symfony/css-selector/XPath/Extension/HtmlExtension.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
39 /** 39 /**
40 * {@inheritdoc} 40 * {@inheritdoc}
41 */ 41 */
42 public function getPseudoClassTranslators() 42 public function getPseudoClassTranslators()
43 { 43 {
44 return array( 44 return [
45 'checked' => array($this, 'translateChecked'), 45 'checked' => [$this, 'translateChecked'],
46 'link' => array($this, 'translateLink'), 46 'link' => [$this, 'translateLink'],
47 'disabled' => array($this, 'translateDisabled'), 47 'disabled' => [$this, 'translateDisabled'],
48 'enabled' => array($this, 'translateEnabled'), 48 'enabled' => [$this, 'translateEnabled'],
49 'selected' => array($this, 'translateSelected'), 49 'selected' => [$this, 'translateSelected'],
50 'invalid' => array($this, 'translateInvalid'), 50 'invalid' => [$this, 'translateInvalid'],
51 'hover' => array($this, 'translateHover'), 51 'hover' => [$this, 'translateHover'],
52 'visited' => array($this, 'translateVisited'), 52 'visited' => [$this, 'translateVisited'],
53 ); 53 ];
54 } 54 }
55 55
56 /** 56 /**
57 * {@inheritdoc} 57 * {@inheritdoc}
58 */ 58 */
59 public function getFunctionTranslators() 59 public function getFunctionTranslators()
60 { 60 {
61 return array( 61 return [
62 'lang' => array($this, 'translateLang'), 62 'lang' => [$this, 'translateLang'],
63 ); 63 ];
64 } 64 }
65 65
66 /** 66 /**
67 * @return XPathExpr 67 * @return XPathExpr
68 */ 68 */
156 public function translateLang(XPathExpr $xpath, FunctionNode $function) 156 public function translateLang(XPathExpr $xpath, FunctionNode $function)
157 { 157 {
158 $arguments = $function->getArguments(); 158 $arguments = $function->getArguments();
159 foreach ($arguments as $token) { 159 foreach ($arguments as $token) {
160 if (!($token->isString() || $token->isIdentifier())) { 160 if (!($token->isString() || $token->isIdentifier())) {
161 throw new ExpressionErrorException( 161 throw new ExpressionErrorException('Expected a single string or identifier for :lang(), got '.implode(', ', $arguments));
162 'Expected a single string or identifier for :lang(), got '
163 .implode(', ', $arguments)
164 );
165 } 162 }
166 } 163 }
167 164
168 return $xpath->addCondition(sprintf( 165 return $xpath->addCondition(sprintf(
169 'ancestor-or-self::*[@lang][1][starts-with(concat(' 166 'ancestor-or-self::*[@lang][1][starts-with(concat('