@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Radowoj\Crawla; |
| 6 | 6 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | protected function crawlPages() |
| 240 | 240 | {
|
| 241 | - while($page = $this->getQueued()->shift()) {
|
|
| 241 | + while ($page = $this->getQueued()->shift()) {
|
|
| 242 | 242 | if ($this->maxDepth !== self::DEPTH_INFINITE && $page['depth'] > $this->maxDepth) {
|
| 243 | 243 | $this->getTooDeep()->append([$page['url']], $page['depth']); |
| 244 | 244 | continue; |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | {
|
| 287 | 287 | $links = $domCrawler->filter($this->linkSelector)->links(); |
| 288 | 288 | |
| 289 | - $urls = array_map(function ($link) {
|
|
| 289 | + $urls = array_map(function($link) {
|
|
| 290 | 290 | $url = $link->getUri(); |
| 291 | 291 | $url = explode('#', $url);
|
| 292 | 292 | return $url[0]; |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | || !is_int($element[self::ELEMENT_DEPTH_KEY]) |
| 54 | 54 | ) {
|
| 55 | 55 | throw new InvalidArgumentException( |
| 56 | - 'Pushed item must be an array [' . self::ELEMENT_URL_KEY |
|
| 57 | - . ' => url (string), ' . self::ELEMENT_DEPTH_KEY.' => depth (int)]' |
|
| 56 | + 'Pushed item must be an array ['.self::ELEMENT_URL_KEY |
|
| 57 | + . ' => url (string), '.self::ELEMENT_DEPTH_KEY.' => depth (int)]' |
|
| 58 | 58 | ); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | public function fromArray(array $sourceArray) |
| 133 | 133 | {
|
| 134 | 134 | $this->items = []; |
| 135 | - foreach($sourceArray as $url => $depth) {
|
|
| 135 | + foreach ($sourceArray as $url => $depth) {
|
|
| 136 | 136 | if (!is_string($url) || !is_int($depth)) {
|
| 137 | 137 | throw new InvalidArgumentException("Source array must consist of url (string) => depth (int) key-value pairs");
|
| 138 | 138 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | public function toAssoc() |
| 146 | 146 | {
|
| 147 | 147 | $assoc = []; |
| 148 | - foreach($this->items as $url => $depth) {
|
|
| 148 | + foreach ($this->items as $url => $depth) {
|
|
| 149 | 149 | $assoc[] = $this->element($url, $depth); |
| 150 | 150 | } |
| 151 | 151 | return $assoc; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | public function fromAssoc(array $sourceAssoc) |
| 156 | 156 | {
|
| 157 | 157 | $this->items = []; |
| 158 | - foreach($sourceAssoc as $item) {
|
|
| 158 | + foreach ($sourceAssoc as $item) {
|
|
| 159 | 159 | $this->pushElement($item); |
| 160 | 160 | } |
| 161 | 161 | |