Skip to content

Commit a8e85ec

Browse files
committed
Make some CS changes
1 parent 4c74dea commit a8e85ec

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Crawler implements \Countable, \IteratorAggregate
3434
private $namespaces = [];
3535

3636
/**
37-
* @var \ArrayIterator A map of cached namespaces
37+
* @var \ArrayObject A map of cached namespaces
3838
*/
3939
private $cachedNamespaces;
4040

@@ -73,7 +73,7 @@ public function __construct($node = null, string $uri = null, string $baseHref =
7373
$this->uri = $uri;
7474
$this->baseHref = $baseHref ?: $uri;
7575
$this->html5Parser = class_exists(HTML5::class) ? new HTML5(['disable_html_ns' => true]) : null;
76-
$this->cachedNamespaces = new \ArrayIterator();
76+
$this->cachedNamespaces = new \ArrayObject();
7777

7878
$this->add($node);
7979
}
@@ -105,7 +105,7 @@ public function clear()
105105
{
106106
$this->nodes = [];
107107
$this->document = null;
108-
$this->cachedNamespaces = new \ArrayIterator();
108+
$this->cachedNamespaces = new \ArrayObject();
109109
}
110110

111111
/**
@@ -1198,17 +1198,14 @@ private function discoverNamespace(\DOMXPath $domxpath, string $prefix): ?string
11981198
return $this->namespaces[$prefix];
11991199
}
12001200

1201-
if ($this->cachedNamespaces->offsetExists($prefix)) {
1202-
return $this->cachedNamespaces->offsetGet($prefix);
1201+
if (isset($this->cachedNamespaces[$prefix])) {
1202+
return $this->cachedNamespaces[$prefix];
12031203
}
12041204

12051205
// ask for one namespace, otherwise we'd get a collection with an item for each node
12061206
$namespaces = $domxpath->query(sprintf('(//namespace::*[name()="%s"])[last()]', $this->defaultNamespacePrefix === $prefix ? '' : $prefix));
12071207

1208-
$namespace = ($node = $namespaces->item(0)) ? $node->nodeValue : null;
1209-
$this->cachedNamespaces->offsetSet($prefix, $namespace);
1210-
1211-
return $namespace;
1208+
return $this->cachedNamespaces[$prefix] = ($node = $namespaces->item(0)) ? $node->nodeValue : null;
12121209
}
12131210

12141211
private function findNamespacePrefixes(string $xpath): array

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy