Completed
Push — master ( faba57...0b7b7b )
by Nils
02:01
created
src/Rules/Html/InvalidUrlsRule.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,22 +18,22 @@
 block discarded – undo
18 18
      */
19 19
     protected function doValidation(ResponseInterface $response)
20 20
     {
21
-        $document = new Document((string)$response->getBody(), false);
21
+        $document = new Document((string) $response->getBody(), false);
22 22
         $urls = $document->getDependencies($response->getUri());
23 23
         $invalidUrls = array();
24 24
 
25 25
         foreach ($urls as $url) {
26 26
             if (function_exists('idn_to_ascii')) {
27
-                $idnUrl = $url->getScheme() . '://' . idn_to_ascii($url->getHost()) . $url->getPath();
27
+                $idnUrl = $url->getScheme().'://'.idn_to_ascii($url->getHost()).$url->getPath();
28 28
             } else {
29
-                $idnUrl = $url->getScheme() . '://' . $url->getHost() . $url->getPath();
29
+                $idnUrl = $url->getScheme().'://'.$url->getHost().$url->getPath();
30 30
             }
31 31
 
32 32
             if (!filter_var($idnUrl, FILTER_VALIDATE_URL)) {
33
-                $invalidUrls[] = (string)$url;
33
+                $invalidUrls[] = (string) $url;
34 34
             }
35 35
         }
36 36
 
37
-        $this->assert(count($invalidUrls) === 0, 'Invalid urls found (' . implode(', ', $invalidUrls) . ').');
37
+        $this->assert(count($invalidUrls) === 0, 'Invalid urls found ('.implode(', ', $invalidUrls).').');
38 38
     }
39 39
 }
Please login to merge, or discard this patch.
src/Cli/Command/SmokeCommand.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
     protected function writeSmokeCredentials($url = null)
49 49
     {
50 50
         if (defined('SMOKE_CREDENTIALS')) {
51
-            $this->output->writeln("\n " . SMOKE_CREDENTIALS . "\n");
51
+            $this->output->writeln("\n ".SMOKE_CREDENTIALS."\n");
52 52
         } else {
53
-            $this->output->writeln("\n Smoke " . SMOKE_VERSION . " by Nils Langner\n");
53
+            $this->output->writeln("\n Smoke ".SMOKE_VERSION." by Nils Langner\n");
54 54
         }
55 55
 
56 56
         if ($url) {
57
-            $this->output->writeln(' <info>Scanning ' . $url . "</info>\n");
57
+            $this->output->writeln(' <info>Scanning '.$url."</info>\n");
58 58
         }
59 59
     }
60 60
 
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
         if ($configFile) {
102 102
             if (strpos($configFile, 'http://') === 0 || strpos($configFile, 'https://') === 0) {
103 103
                 $curlClient = new Client();
104
-                $fileContent = (string)$curlClient->get($configFile)->getBody();
104
+                $fileContent = (string) $curlClient->get($configFile)->getBody();
105 105
             } else {
106 106
                 if (file_exists($configFile)) {
107 107
                     $fileContent = file_get_contents($configFile);
108 108
                 } else {
109
-                    throw new \RuntimeException("Config file was not found ('" . $configFile . "').");
109
+                    throw new \RuntimeException("Config file was not found ('".$configFile."').");
110 110
                 }
111 111
             }
112 112
             $configArray = EnvAwareYaml::parse($fileContent);
Please login to merge, or discard this patch.
SmokeResponseRetriever/Retriever/Crawler/Filter/BlackWhiteListFilter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@
 block discarded – undo
15 15
     public function isFiltered(UriInterface $uri, UriInterface $startPage)
16 16
     {
17 17
         foreach ($this->whitelist as $whitelist) {
18
-            if (preg_match($whitelist, (string)$uri)) {
18
+            if (preg_match($whitelist, (string) $uri)) {
19 19
                 foreach ($this->blacklist as $blacklist) {
20
-                    if (preg_match($blacklist, (string)$uri)) {
20
+                    if (preg_match($blacklist, (string) $uri)) {
21 21
                         return true;
22 22
                     }
23 23
                 }
Please login to merge, or discard this patch.
src/Rules/Http/RedirectRule.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,30 +28,30 @@  discard block
 block discarded – undo
28 28
         $client = new GuzzleClient();
29 29
         $errors = [];
30 30
 
31
-        $targetUrl = (string)$this->removeCredentials($response->getUri());
31
+        $targetUrl = (string) $this->removeCredentials($response->getUri());
32 32
 
33 33
 
34 34
         foreach ($this->urls as $url) {
35 35
             $uri = new Uri($url['url']);
36 36
 
37 37
             $urlResponses = $client->sendRequests([new Request('GET', $uri)]);
38
-            $effectiveUrl = (string)$urlResponses[0]->getEffectiveUri();
38
+            $effectiveUrl = (string) $urlResponses[0]->getEffectiveUri();
39 39
 
40 40
             if ($effectiveUrl != $targetUrl) {
41
-                $errors[] = 'The url "' . $url['url'] . '" gets redirected to "' . $effectiveUrl . '".';
41
+                $errors[] = 'The url "'.$url['url'].'" gets redirected to "'.$effectiveUrl.'".';
42 42
             }
43 43
         }
44 44
 
45 45
         if (count($errors) > 0) {
46
-            $message = 'Not all given urls do redirect to "' . $targetUrl . '"".<ul>';
46
+            $message = 'Not all given urls do redirect to "'.$targetUrl.'"".<ul>';
47 47
             foreach ($errors as $error) {
48
-                $message .= '<li>' . $error . '</li>';
48
+                $message .= '<li>'.$error.'</li>';
49 49
             }
50 50
             $message .= "</ul>";
51 51
 
52 52
             return new CheckResult(CheckResult::STATUS_FAILURE, $message);
53 53
         } else {
54
-            return new CheckResult(CheckResult::STATUS_SUCCESS, 'All given urls redirect to ' . (string)$response->getUri());
54
+            return new CheckResult(CheckResult::STATUS_SUCCESS, 'All given urls redirect to '.(string) $response->getUri());
55 55
         }
56 56
     }
57 57
 
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
     {
60 60
         $query = '';
61 61
         if ($uri->getQuery()) {
62
-            $query = "?" . $uri->getQuery();
62
+            $query = "?".$uri->getQuery();
63 63
         }
64 64
 
65
-        $plainUri = $uri->getScheme() . '://' . $uri->getHost() . $uri->getPath() . $query;
65
+        $plainUri = $uri->getScheme().'://'.$uri->getHost().$uri->getPath().$query;
66 66
 
67 67
         return new Uri($plainUri);
68 68
     }
Please login to merge, or discard this patch.
src/Rules/Xml/Rss/ValidRule.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
 
24 24
     private function getSchema()
25 25
     {
26
-        return __DIR__ . '/' . self::SCHEMA;
26
+        return __DIR__.'/'.self::SCHEMA;
27 27
     }
28 28
 
29 29
     public function doValidation(ResponseInterface $response)
30 30
     {
31
-        $body = (string)$response->getBody();
31
+        $body = (string) $response->getBody();
32 32
 
33 33
         if (preg_match('/<rss/', $body)) {
34 34
             libxml_clear_errors();
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
             if ($lastError) {
40 40
                 throw new ValidationFailedException(
41
-                    'The given xml file is not well formed (last error: ' .
42
-                    str_replace("\n", '', $lastError->message) . ').');
41
+                    'The given xml file is not well formed (last error: '.
42
+                    str_replace("\n", '', $lastError->message).').');
43 43
             }
44 44
 
45 45
             $valid = @$dom->schemaValidate($this->getSchema());
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
                 $lastErrorMessage = str_replace("\n", '', $lastError->message);
50 50
 
51 51
                 if ($response instanceof UriAwareResponse) {
52
-                    $toolUrl = sprintf(self::PUBLIC_SERVICE, urlencode((string)$response->getUri()));
52
+                    $toolUrl = sprintf(self::PUBLIC_SERVICE, urlencode((string) $response->getUri()));
53 53
                 } else {
54 54
                     $toolUrl = '';
55 55
                 }
56
-                return new CheckResult(CheckResult::STATUS_FAILURE, 'The given xml file is not a valid rss file (last error: ' . $lastErrorMessage . ').', null, $toolUrl);
56
+                return new CheckResult(CheckResult::STATUS_FAILURE, 'The given xml file is not a valid rss file (last error: '.$lastErrorMessage.').', null, $toolUrl);
57 57
             }
58 58
         }
59 59
         return new CheckResult(CheckResult::STATUS_SUCCESS, 'The given rss file is valid.');
Please login to merge, or discard this patch.
SmokeResponseRetriever/Retriever/Crawler/Filter/LongUrlFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
      */
20 20
     public function isFiltered(UriInterface $currentUri, UriInterface $startUri)
21 21
     {
22
-        return strlen((string)$currentUri) > 255;
22
+        return strlen((string) $currentUri) > 255;
23 23
     }
24 24
 
25 25
     public function isResponseFiltered(ResponseInterface $response, UriInterface $startUri)
Please login to merge, or discard this patch.
src/Rules/Seo/RobotsDisallowAllRule.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use phm\HttpWebdriverClient\Http\Response\UriAwareResponse;
6 6
 use Psr\Http\Message\ResponseInterface;
7
-use whm\Smoke\Http\ClientAware;
8
-use whm\Smoke\Http\Response;
9 7
 use whm\Smoke\Rules\Rule;
10 8
 use whm\Smoke\Rules\ValidationFailedException;
11 9
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
     public function validate(ResponseInterface $response)
22 22
     {
23 23
         if ($response instanceof UriAwareResponse) {
24
-            $url = $response->getUri()->getScheme() . '://' . $response->getUri()->getHost();
24
+            $url = $response->getUri()->getScheme().'://'.$response->getUri()->getHost();
25 25
 
26 26
             if (substr_count($url, '/') === 2) {
27
-                $filename = $robotsUrl = $url . '/robots.txt';
27
+                $filename = $robotsUrl = $url.'/robots.txt';
28 28
             } elseif (substr_count($url, '/') === 3) {
29
-                $filename = $robotsUrl = $url . 'robots.txt';
29
+                $filename = $robotsUrl = $url.'robots.txt';
30 30
             } else {
31 31
                 return;
32 32
             }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
             $normalizedContent = $this->normalizeContent($content);
41 41
 
42
-            if (strpos($normalizedContent, 'user-agent:* disallow:/' . PHP_EOL) !== false) {
42
+            if (strpos($normalizedContent, 'user-agent:* disallow:/'.PHP_EOL) !== false) {
43 43
                 throw new ValidationFailedException('The robots.txt contains disallow all (Disallow: /)');
44 44
             }
45 45
 
Please login to merge, or discard this patch.