Completed
Push — master ( 1f85a6...563d08 )
by Nils
01:41
created
src/Rules/Http/Header/GZipRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
                 && strpos($response->getContentType(), 'pdf') === false
27 27
                 && strpos($response->getContentType(), 'postscript') === false
28 28
                 && strpos($response->getContentType(), 'zip') === false
29
-                && strlen((string)$response->getBody()) >= $this->minFileSize
29
+                && strlen((string) $response->getBody()) >= $this->minFileSize
30 30
             ) {
31 31
                 if (!$response->hasHeader('Content-Encoding') || $response->getHeader('Content-Encoding')[0] !== 'gzip') {
32 32
                     throw new ValidationFailedException('gzip compression not active');
Please login to merge, or discard this patch.
src/Extensions/SmokeReporter/Reporter/CliReporter.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
         if ($response instanceof RequestAwareResponse) {
38 38
             $request = $response->getRequest();
39 39
             if ($request instanceof DeviceAwareRequest) {
40
-                return ' (Device: ' . $request->getDevice()->getName() . ')';
40
+                return ' (Device: '.$request->getDevice()->getName().')';
41 41
             } else if ($request instanceof ViewportAwareRequest) {
42 42
                 $viewport = $request->getViewport();
43
-                return ' (Viewport: width: ' . $viewport->getWidth() . ', height: ' . $viewport->getHeight() . ')';
43
+                return ' (Viewport: width: '.$viewport->getWidth().', height: '.$viewport->getHeight().')';
44 44
             }
45 45
         }
46 46
 
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
 
50 50
     protected function renderFailure(CheckResult $result)
51 51
     {
52
-        $this->output->writeln('   <error> ' . (string)$result->getResponse()->getUri() . $this->getRequestString($result->getResponse()) . ' </error> coming from ' . (string)$this->retriever->getComingFrom($result->getResponse()->getUri()));
53
-        $this->output->writeln('    - ' . $result->getMessage() . ' [rule: ' . $result->getRuleName() . ']');
52
+        $this->output->writeln('   <error> '.(string) $result->getResponse()->getUri().$this->getRequestString($result->getResponse()).' </error> coming from '.(string) $this->retriever->getComingFrom($result->getResponse()->getUri()));
53
+        $this->output->writeln('    - '.$result->getMessage().' [rule: '.$result->getRuleName().']');
54 54
         $this->output->writeln('');
55 55
     }
56 56
 
57 57
     protected function renderSuccess(CheckResult $result)
58 58
     {
59
-        $this->output->writeln('   <info> ' . (string)$result->getResponse()->getUri() . $this->getRequestString($result->getResponse()) . ' </info> all tests passed');
59
+        $this->output->writeln('   <info> '.(string) $result->getResponse()->getUri().$this->getRequestString($result->getResponse()).' </info> all tests passed');
60 60
     }
61 61
 
62 62
     protected function renderSkipped(CheckResult $result)
63 63
     {
64
-        $this->output->writeln('   <comment> ' . (string)$result->getResponse()->getUri() . $this->getRequestString($result->getResponse()) . ' </comment>test skipped');
65
-        $this->output->writeln('    - ' . $result->getMessage() . ' [rule: ' . $result->getRuleName() . ']');
64
+        $this->output->writeln('   <comment> '.(string) $result->getResponse()->getUri().$this->getRequestString($result->getResponse()).' </comment>test skipped');
65
+        $this->output->writeln('    - '.$result->getMessage().' [rule: '.$result->getRuleName().']');
66 66
     }
67 67
 }
Please login to merge, or discard this patch.
src/Rules/Html/XPathExistsRule.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 
32 32
         // @todo this could be part of an abstract class
33 33
         if ($this->useDom) {
34
-            $content = (string)$response->getBody();
34
+            $content = (string) $response->getBody();
35 35
         } else {
36 36
             if ($response instanceof DomAwareResponse) {
37 37
                 $content = $response->getHtmlBody();
38 38
             } else {
39
-                $content = (string)$response->getBody();
39
+                $content = (string) $response->getBody();
40 40
             }
41 41
         }
42 42
 
@@ -48,16 +48,16 @@  discard block
 block discarded – undo
48 48
             $count = $domXPath->query($xpath['pattern'])->length;
49 49
 
50 50
             if ($xpath['relation'] === 'equals') {
51
-                $result = $count === (int)$xpath['value'];
52
-                $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were exact ' . $xpath['value'] . ' occurencies.';
51
+                $result = $count === (int) $xpath['value'];
52
+                $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were exact '.$xpath['value'].' occurencies.';
53 53
             } elseif ($xpath['relation'] === 'less than') {
54
-                $result = $count < (int)$xpath['value'];
55
-                $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were less than ' . $xpath['value'] . '.';
54
+                $result = $count < (int) $xpath['value'];
55
+                $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were less than '.$xpath['value'].'.';
56 56
             } elseif ($xpath['relation'] === 'greater than') {
57
-                $result = $count > (int)$xpath['value'];
58
-                $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were more than ' . $xpath['value'] . '.';
57
+                $result = $count > (int) $xpath['value'];
58
+                $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were more than '.$xpath['value'].'.';
59 59
             } else {
60
-                throw new \RuntimeException('Relation not defined. Given "' . $xpath['relation'] . '" expected [equals, greater than, less than]');
60
+                throw new \RuntimeException('Relation not defined. Given "'.$xpath['relation'].'" expected [equals, greater than, less than]');
61 61
             }
62 62
 
63 63
             $this->assert($result, $message);
Please login to merge, or discard this patch.
src/Rules/Http/DurationRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@
 block discarded – undo
29 29
             if ($response->getDuration() > $this->maxDuration) {
30 30
                 return new CheckResult(
31 31
                     CheckResult::STATUS_FAILURE,
32
-                    'The http request took ' . (int)$response->getDuration() . ' milliseconds (limit was ' . $this->maxDuration . 'ms).',
33
-                    (int)$response->getDuration());
32
+                    'The http request took '.(int) $response->getDuration().' milliseconds (limit was '.$this->maxDuration.'ms).',
33
+                    (int) $response->getDuration());
34 34
             }
35 35
 
36 36
             return new CheckResult(
37 37
                 CheckResult::STATUS_SUCCESS,
38
-                'The http request took ' . (int)$response->getDuration() . ' milliseconds (limit was ' . $this->maxDuration . 'ms).',
39
-                (int)$response->getDuration());
38
+                'The http request took '.(int) $response->getDuration().' milliseconds (limit was '.$this->maxDuration.'ms).',
39
+                (int) $response->getDuration());
40 40
         }
41 41
     }
42 42
 }
Please login to merge, or discard this patch.
src/Rules/Xml/Sitemap/ValidRule.php 2 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,6 +27,9 @@  discard block
 block discarded – undo
27 27
         $this->strictMode = $strictMode;
28 28
     }
29 29
 
30
+    /**
31
+     * @param boolean $isIndex
32
+     */
30 33
     private function getSchema($isIndex)
31 34
     {
32 35
         if ($isIndex) {
@@ -41,8 +44,8 @@  discard block
 block discarded – undo
41 44
     }
42 45
 
43 46
     /**
44
-     * @param $body
45
-     * @param $filename
47
+     * @param string $body
48
+     * @param string $filename
46 49
      * @param bool $isIndex
47 50
      * @throws ValidationFailedException
48 51
      */
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
     private function getSchema($isIndex)
35 35
     {
36 36
         if ($isIndex) {
37
-            return __DIR__ . '/' . self::INDEX;
37
+            return __DIR__.'/'.self::INDEX;
38 38
         }
39 39
 
40 40
         if ($this->strictMode) {
41
-            return __DIR__ . '/' . self::SCHEMA;
41
+            return __DIR__.'/'.self::SCHEMA;
42 42
         } else {
43
-            return __DIR__ . '/' . self::NON_STRICT_SCHEMA;
43
+            return __DIR__.'/'.self::NON_STRICT_SCHEMA;
44 44
         }
45 45
     }
46 46
 
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 
66 66
         if (!$valid) {
67 67
             $lastError = libxml_get_last_error();
68
-            $message = 'The given sitemap file (' . $filename . ') did not validate against the sitemap schema (last error: ' . str_replace("\n", '', $lastError->message) . ').';
68
+            $message = 'The given sitemap file ('.$filename.') did not validate against the sitemap schema (last error: '.str_replace("\n", '', $lastError->message).').';
69 69
             return new CheckResult(CheckResult::STATUS_FAILURE, $message);
70 70
         } else {
71
-            $message = 'The given sitemap file (' . $filename . ') is valid.';
71
+            $message = 'The given sitemap file ('.$filename.') is valid.';
72 72
             return new CheckResult(CheckResult::STATUS_SUCCESS, $message);
73 73
 
74 74
         }
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
     protected function doValidation(ResponseInterface $response)
82 82
     {
83 83
         if ($response instanceof DomAwareResponse) {
84
-            $body = (string)$response->getHtmlBody();
84
+            $body = (string) $response->getHtmlBody();
85 85
         } else {
86
-            $body = (string)$response->getBody();
86
+            $body = (string) $response->getBody();
87 87
         }
88 88
 
89 89
         if ($response->hasHeader('content-type')) {
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 
96 96
         // sitemapindex or urlset
97 97
         if (preg_match('/<sitemapindex/', $body)) {
98
-            return $this->validateBody($body, (string)$response->getUri(), true);
98
+            return $this->validateBody($body, (string) $response->getUri(), true);
99 99
         } elseif (preg_match('/<urlset/', $body)) {
100
-            return $this->validateBody($body, (string)$response->getUri(), false);
100
+            return $this->validateBody($body, (string) $response->getUri(), false);
101 101
         } else {
102 102
             throw new ValidationFailedException('The given document is not a valid sitemap. Nether sitemapindex nor urlset element was found. ');
103 103
         }
Please login to merge, or discard this patch.
src/Rules/Xml/XmlCheckRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
     public function doValidation(ResponseInterface $response)
25 25
     {
26 26
         if ($response instanceof DomAwareResponse) {
27
-            $body = (string)$response->getHtmlBody();
27
+            $body = (string) $response->getHtmlBody();
28 28
         } else {
29
-            $body = (string)$response->getBody();
29
+            $body = (string) $response->getBody();
30 30
         }
31 31
 
32 32
         if ($body == "") {
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
             $lastError = libxml_get_last_error();
46 46
 
47 47
             if ($lastError) {
48
-                throw new ValidationFailedException('The xml file ' . $response->getUri() . ' is not well formed (last error: ' .
49
-                    str_replace("\n", '', $lastError->message) . ').');
48
+                throw new ValidationFailedException('The xml file '.$response->getUri().' is not well formed (last error: '.
49
+                    str_replace("\n", '', $lastError->message).').');
50 50
             } else {
51 51
                 return new CheckResult(CheckResult::STATUS_FAILURE, 'Unknown error occured.');
52 52
             }
Please login to merge, or discard this patch.
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.