@@ -13,7 +13,7 @@ |
||
| 13 | 13 | { |
| 14 | 14 | $mixedContent = MixedContentExtractor::extract((string) $response->getBody(), $url); |
| 15 | 15 | |
| 16 | - if (! count($mixedContent)) { |
|
| 16 | + if (!count($mixedContent)) { |
|
| 17 | 17 | $this->noMixedContentFound($url); |
| 18 | 18 | |
| 19 | 19 | return; |
@@ -12,13 +12,13 @@ discard block |
||
| 12 | 12 | public static function extract(string $html, string $currentUri): array |
| 13 | 13 | { |
| 14 | 14 | return static::getSearchNodes() |
| 15 | - ->mapSpread(function ($tagName, $attribute) use ($html, $currentUri) { |
|
| 15 | + ->mapSpread(function($tagName, $attribute) use ($html, $currentUri) { |
|
| 16 | 16 | return (new DomCrawler($html, $currentUri)) |
| 17 | 17 | ->filterXPath("//{$tagName}[@{$attribute}]") |
| 18 | - ->reduce(function (DomCrawler $node) { |
|
| 19 | - return ! self::isShortLink($node); |
|
| 18 | + ->reduce(function(DomCrawler $node) { |
|
| 19 | + return !self::isShortLink($node); |
|
| 20 | 20 | }) |
| 21 | - ->each(function (DomCrawler $node) use ($tagName, $attribute) { |
|
| 21 | + ->each(function(DomCrawler $node) use ($tagName, $attribute) { |
|
| 22 | 22 | try { |
| 23 | 23 | $url = new Uri($node->attr($attribute)); |
| 24 | 24 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - return $url->getScheme() === 'http' ? [$tagName, $url] : null; |
|
| 31 | + return $url->getScheme() === 'http' ? [ $tagName, $url ] : null; |
|
| 32 | 32 | } catch (Exception $e) { |
| 33 | 33 | // ignore invalid links |
| 34 | 34 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | }) |
| 37 | 37 | ->flatten(1) |
| 38 | 38 | ->filter() |
| 39 | - ->mapSpread(function ($tagName, $mixedContentUrl) use ($currentUri) { |
|
| 39 | + ->mapSpread(function($tagName, $mixedContentUrl) use ($currentUri) { |
|
| 40 | 40 | return new MixedContent($tagName, $mixedContentUrl, new Uri($currentUri)); |
| 41 | 41 | }) |
| 42 | 42 | ->toArray(); |
@@ -45,19 +45,19 @@ discard block |
||
| 45 | 45 | protected static function getSearchNodes(): Collection |
| 46 | 46 | { |
| 47 | 47 | return collect([ |
| 48 | - ['audio', 'src'], |
|
| 49 | - ['embed', 'src'], |
|
| 50 | - ['form', 'action'], |
|
| 51 | - ['link', 'href'], |
|
| 52 | - ['iframe', 'src'], |
|
| 53 | - ['img', 'src'], |
|
| 54 | - ['img', 'srcset'], |
|
| 55 | - ['object', 'data'], |
|
| 56 | - ['param', 'value'], |
|
| 57 | - ['script', 'src'], |
|
| 58 | - ['source', 'src'], |
|
| 59 | - ['source', 'srcset'], |
|
| 60 | - ['video', 'src'], |
|
| 48 | + [ 'audio', 'src' ], |
|
| 49 | + [ 'embed', 'src' ], |
|
| 50 | + [ 'form', 'action' ], |
|
| 51 | + [ 'link', 'href' ], |
|
| 52 | + [ 'iframe', 'src' ], |
|
| 53 | + [ 'img', 'src' ], |
|
| 54 | + [ 'img', 'srcset' ], |
|
| 55 | + [ 'object', 'data' ], |
|
| 56 | + [ 'param', 'value' ], |
|
| 57 | + [ 'script', 'src' ], |
|
| 58 | + [ 'source', 'src' ], |
|
| 59 | + [ 'source', 'srcset' ], |
|
| 60 | + [ 'video', 'src' ], |
|
| 61 | 61 | ]); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | $this->mixedContentObserver = $mixedContentObserver; |
| 25 | 25 | |
| 26 | - $this->configureCrawler = function (Crawler $crawler) { |
|
| 26 | + $this->configureCrawler = function(Crawler $crawler) { |
|
| 27 | 27 | }; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function scan(string $url, array $clientOptions = []): void |
|
| 30 | + public function scan(string $url, array $clientOptions = [ ]): void |
|
| 31 | 31 | { |
| 32 | 32 | $this->guardAgainstInvalidUrl($url); |
| 33 | 33 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | throw InvalidUrl::urlIsEmpty(); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if (! $this->startsWith($url, ['http://', 'https://'])) { |
|
| 69 | + if (!$this->startsWith($url, [ 'http://', 'https://' ])) { |
|
| 70 | 70 | throw InvalidUrl::invalidScheme($url); |
| 71 | 71 | } |
| 72 | 72 | } |