Skip to content

Commit ea68704

Browse files
committed
fixed CS
1 parent b9e4d94 commit ea68704

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

Crawler.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Crawler implements \Countable, \IteratorAggregate
3030
/**
3131
* @var array A map of manually registered namespaces
3232
*/
33-
private $namespaces = array();
33+
private $namespaces = [];
3434

3535
/**
3636
* @var string The base href value
@@ -45,7 +45,7 @@ class Crawler implements \Countable, \IteratorAggregate
4545
/**
4646
* @var \DOMElement[]
4747
*/
48-
private $nodes = array();
48+
private $nodes = [];
4949

5050
/**
5151
* Whether the Crawler contains HTML or XML content (used when converting CSS to XPath).
@@ -92,7 +92,7 @@ public function getBaseHref()
9292
*/
9393
public function clear()
9494
{
95-
$this->nodes = array();
95+
$this->nodes = [];
9696
$this->document = null;
9797
}
9898

@@ -208,7 +208,7 @@ public function addHtmlContent($content, $charset = 'UTF-8')
208208

209209
$this->addDocument($dom);
210210

211-
$base = $this->filterRelativeXPath('descendant-or-self::base')->extract(array('href'));
211+
$base = $this->filterRelativeXPath('descendant-or-self::base')->extract(['href']);
212212

213213
$baseHref = current($base);
214214
if (\count($base) && !empty($baseHref)) {
@@ -363,7 +363,7 @@ public function eq($position)
363363
*/
364364
public function each(\Closure $closure)
365365
{
366-
$data = array();
366+
$data = [];
367367
foreach ($this->nodes as $i => $node) {
368368
$data[] = $closure($this->createSubCrawler($node), $i);
369369
}
@@ -395,7 +395,7 @@ public function slice($offset = 0, $length = null)
395395
*/
396396
public function reduce(\Closure $closure)
397397
{
398-
$nodes = array();
398+
$nodes = [];
399399
foreach ($this->nodes as $i => $node) {
400400
if (false !== $closure($this->createSubCrawler($node), $i)) {
401401
$nodes[] = $node;
@@ -487,7 +487,7 @@ public function parents()
487487
}
488488

489489
$node = $this->getNode(0);
490-
$nodes = array();
490+
$nodes = [];
491491

492492
while ($node = $node->parentNode) {
493493
if (XML_ELEMENT_NODE === $node->nodeType) {
@@ -513,7 +513,7 @@ public function children()
513513

514514
$node = $this->getNode(0)->firstChild;
515515

516-
return $this->createSubCrawler($node ? $this->sibling($node) : array());
516+
return $this->createSubCrawler($node ? $this->sibling($node) : []);
517517
}
518518

519519
/**
@@ -605,7 +605,7 @@ public function evaluate($xpath)
605605
throw new \LogicException('Cannot evaluate the expression on an uninitialized crawler.');
606606
}
607607

608-
$data = array();
608+
$data = [];
609609
$domxpath = $this->createDOMXPath($this->document, $this->findNamespacePrefixes($xpath));
610610

611611
foreach ($this->nodes as $node) {
@@ -637,9 +637,9 @@ public function extract($attributes)
637637
$attributes = (array) $attributes;
638638
$count = \count($attributes);
639639

640-
$data = array();
640+
$data = [];
641641
foreach ($this->nodes as $node) {
642-
$elements = array();
642+
$elements = [];
643643
foreach ($attributes as $attribute) {
644644
if ('_text' === $attribute) {
645645
$elements[] = $node->nodeValue;
@@ -776,7 +776,7 @@ public function link($method = 'get')
776776
*/
777777
public function links()
778778
{
779-
$links = array();
779+
$links = [];
780780
foreach ($this->nodes as $node) {
781781
if (!$node instanceof \DOMElement) {
782782
throw new \InvalidArgumentException(sprintf('The current node list should contain only DOMElement instances, "%s" found.', \get_class($node)));
@@ -817,7 +817,7 @@ public function image()
817817
*/
818818
public function images()
819819
{
820-
$images = array();
820+
$images = [];
821821
foreach ($this as $node) {
822822
if (!$node instanceof \DOMElement) {
823823
throw new \InvalidArgumentException(sprintf('The current node list should contain only DOMElement instances, "%s" found.', \get_class($node)));
@@ -911,7 +911,7 @@ public static function xpathLiteral($s)
911911
}
912912

913913
$string = $s;
914-
$parts = array();
914+
$parts = [];
915915
while (true) {
916916
if (false !== $pos = strpos($string, "'")) {
917917
$parts[] = sprintf("'%s'", substr($string, 0, $pos));
@@ -957,7 +957,7 @@ private function filterRelativeXPath($xpath)
957957
*/
958958
private function relativize(string $xpath): string
959959
{
960-
$expressions = array();
960+
$expressions = [];
961961

962962
// An expression which will never match to replace expressions which cannot match in the crawler
963963
// We cannot simply drop
@@ -1075,7 +1075,7 @@ public function getIterator()
10751075
*/
10761076
protected function sibling($node, $siblingDir = 'nextSibling')
10771077
{
1078-
$nodes = array();
1078+
$nodes = [];
10791079

10801080
$currentNode = $this->getNode(0);
10811081
do {
@@ -1090,7 +1090,7 @@ protected function sibling($node, $siblingDir = 'nextSibling')
10901090
/**
10911091
* @throws \InvalidArgumentException
10921092
*/
1093-
private function createDOMXPath(\DOMDocument $document, array $prefixes = array()): \DOMXPath
1093+
private function createDOMXPath(\DOMDocument $document, array $prefixes = []): \DOMXPath
10941094
{
10951095
$domxpath = new \DOMXPath($document);
10961096

@@ -1129,7 +1129,7 @@ private function findNamespacePrefixes(string $xpath): array
11291129
return array_unique($matches['prefix']);
11301130
}
11311131

1132-
return array();
1132+
return [];
11331133
}
11341134

11351135
/**

0 commit comments

Comments
 (0)