Completed
Push — master ( 33a55e...ca53a0 )
by Nils
07:47
created
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 Ivory\HttpAdapter\HttpAdapterInterface;
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
 
22 22
     public function validate(ResponseInterface $response)
23 23
     {
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.
src/Rules/StandardRule.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -28,6 +28,10 @@
 block discarded – undo
28 28
 
29 29
     abstract protected function doValidation(ResponseInterface $response);
30 30
 
31
+    /**
32
+     * @param boolean $valueToBeTrue
33
+     * @param string $errorMessage
34
+     */
31 35
     protected function assert($valueToBeTrue, $errorMessage)
32 36
     {
33 37
         if (!$valueToBeTrue) {
Please login to merge, or discard this patch.
src/Rules/Xml/Sitemap/ValidRule.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace whm\Smoke\Rules\Xml\Sitemap;
4 4
 
5 5
 use Psr\Http\Message\ResponseInterface;
6
-use whm\Smoke\Http\Response;
7 6
 use whm\Smoke\Rules\StandardRule;
8 7
 use whm\Smoke\Rules\ValidationFailedException;
9 8
 
Please login to merge, or discard this patch.
src/Extensions/SmokeFilter/FilterExtension.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
     public function init($filters = array(), $filterFile = '', $exclusive = array())
42 42
     {
43 43
         if (count($exclusive) > 0 && (count($filters) > 0 || $filterFile !== '')) {
44
-            throw new \RuntimeException("It's not possible to define filter lists and an exclusive list at the same time [Extension: " . get_class($this) . '].');
44
+            throw new \RuntimeException("It's not possible to define filter lists and an exclusive list at the same time [Extension: ".get_class($this).'].');
45 45
         }
46 46
 
47 47
         if ($filterFile !== '') {
48 48
             if (!file_exists($filterFile)) {
49
-                throw new \RuntimeException('Filter file not found: ' . $filterFile);
49
+                throw new \RuntimeException('Filter file not found: '.$filterFile);
50 50
             }
51 51
 
52 52
             $filterElements = EnvAwareYaml::parse(file_get_contents($filterFile));
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public function isFiltered(Event $event, $ruleName, UriAwareResponse $response)
87 87
     {
88
-        $uri = (string)$this->retriever->getOriginUri($response->getUri());
88
+        $uri = (string) $this->retriever->getOriginUri($response->getUri());
89 89
 
90 90
         if ($this->currentModus === self::MODUS_FILTER) {
91 91
             $isFiltered = $this->isFilteredByFilter($ruleName, $uri);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     private function isFilteredByFilter($ruleName, $uri)
105 105
     {
106 106
         foreach ($this->filters as $filter) {
107
-            if ($ruleName === $filter['rule'] && 0 < preg_match('$' . $filter['uri'] . '$', $uri)) {
107
+            if ($ruleName === $filter['rule'] && 0 < preg_match('$'.$filter['uri'].'$', $uri)) {
108 108
                 return true;
109 109
             }
110 110
         }
Please login to merge, or discard this patch.
src/Extensions/SmokeResponseRetriever/Retriever/ListRetriever/Retriever.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -109,20 +109,20 @@  discard block
 block discarded – undo
109 109
                         /* @var \Ivory\HttpAdapter\HttpAdapterException $exception */
110 110
 
111 111
                         $mainUri = $request->getUri();
112
-                        $this->redirects[(string)$mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl] = (string)$mainUri;
112
+                        $this->redirects[(string) $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl] = (string) $mainUri;
113 113
 
114
-                        $this->urls[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']];
115
-                        $this->urlStack[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']];
114
+                        $this->urls[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']];
115
+                        $this->urlStack[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']];
116 116
 
117 117
                         return $this->next();
118 118
                     }
119 119
 
120 120
                     // the error handling should be done withing the calling class
121
-                    echo "\n   " . $exception->getMessage() . "\n";
121
+                    echo "\n   ".$exception->getMessage()."\n";
122 122
 
123 123
                     return $this->next();
124 124
                 } else {
125
-                    $errorMessages .= $exception->getMessage() . "\n";
125
+                    $errorMessages .= $exception->getMessage()."\n";
126 126
                 }
127 127
             }
128 128
             if ($errorMessages !== '') {
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 
136 136
     public function getOriginUri(UriInterface $uri)
137 137
     {
138
-        if (array_key_exists((string)$uri, $this->redirects)) {
139
-            return $this->urls[$this->redirects[(string)$uri]]['url'];
138
+        if (array_key_exists((string) $uri, $this->redirects)) {
139
+            return $this->urls[$this->redirects[(string) $uri]]['url'];
140 140
         }
141 141
 
142 142
         return $uri;
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
 
150 150
     public function getSystem(UriInterface $uri)
151 151
     {
152
-        if (array_key_exists((string)$uri, $this->redirects)) {
153
-            return $this->urls[$this->redirects[(string)$uri]]['system'];
152
+        if (array_key_exists((string) $uri, $this->redirects)) {
153
+            return $this->urls[$this->redirects[(string) $uri]]['system'];
154 154
         }
155 155
 
156
-        return $this->urls[(string)$uri]['system'];
156
+        return $this->urls[(string) $uri]['system'];
157 157
     }
158 158
 
159 159
     public function getSystems()
Please login to merge, or discard this patch.
src/Extensions/SmokeReporter/Reporter/XUnitReporter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $failures = 0;
60 60
 
61 61
         if ($this->retriever instanceof CrawlingRetriever) {
62
-            $startPage = (string)$this->retriever->getStartPage();
62
+            $startPage = (string) $this->retriever->getStartPage();
63 63
         } else {
64 64
             $startPage = '';
65 65
         }
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
                     $testCase->addFailure(new Failure($ruleName, $message));
81 81
 
82 82
                     if ($this->retriever instanceof CrawlingRetriever) {
83
-                        $stackTrace = $result->getUrl() . ' coming from ' . (string)$this->retriever->getComingFrom($result->getUrl()) . PHP_EOL;
84
-                        $stackTrace .= '    - ' . $message . " [rule: $ruleName]";
83
+                        $stackTrace = $result->getUrl().' coming from '.(string) $this->retriever->getComingFrom($result->getUrl()).PHP_EOL;
84
+                        $stackTrace .= '    - '.$message." [rule: $ruleName]";
85 85
                         $testCase->setSystemOut($stackTrace);
86 86
                     }
87 87
                 }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
         file_put_contents($this->filename, $xUnitReport->toXml());
94 94
 
95
-        $this->output->writeln('    <info>Writing XUnit Output to file:</info> ' . $this->filename);
95
+        $this->output->writeln('    <info>Writing XUnit Output to file:</info> '.$this->filename);
96 96
     }
97 97
 
98 98
     public function processResults($results)
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
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
     private function getSchema()
17 17
     {
18
-        return __DIR__ . '/' . self::SCHEMA;
18
+        return __DIR__.'/'.self::SCHEMA;
19 19
     }
20 20
 
21 21
     public function validate(ResponseInterface $response)
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
             $lastError = libxml_get_last_error();
33 33
             if ($lastError) {
34 34
                 throw new ValidationFailedException(
35
-                    'The given xml file is not well formed (last error: ' .
36
-                    str_replace("\n", '', $lastError->message) . ').');
35
+                    'The given xml file is not well formed (last error: '.
36
+                    str_replace("\n", '', $lastError->message).').');
37 37
             }
38 38
             $valid = @$dom->schemaValidate($this->getSchema());
39 39
             if (!$valid) {
40 40
                 $lastError = libxml_get_last_error();
41 41
                 $lastErrorMessage = str_replace("\n", '', $lastError->message);
42 42
                 throw new ValidationFailedException(
43
-                    'The given xml file did not Validate vs. ' .
44
-                    $this->getSchema() . ' (last error: ' .
45
-                    $lastErrorMessage . ').');
43
+                    'The given xml file did not Validate vs. '.
44
+                    $this->getSchema().' (last error: '.
45
+                    $lastErrorMessage.').');
46 46
             }
47 47
         }
48 48
     }
Please login to merge, or discard this patch.
src/Rules/Image/SizeRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,6 +25,6 @@
 block discarded – undo
25 25
     protected function doValidation(ResponseInterface $response)
26 26
     {
27 27
         $size = strlen($response->getBody()) / 1000;
28
-        $this->assert($size <= $this->maxSize, 'The size of the file is too big (' . $size . ' KB)');
28
+        $this->assert($size <= $this->maxSize, 'The size of the file is too big ('.$size.' KB)');
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
src/Rules/Http/Header/GZipRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
         if ($response instanceof ContentTypeAwareResponse) {
25 25
             if (strpos($response->getContentType(), 'image') === false
26 26
                 && strpos($response->getContentType(), 'pdf') === false
27
-                && strlen((string)$response->getBody()) >= $this->minFileSize
27
+                && strlen((string) $response->getBody()) >= $this->minFileSize
28 28
             ) {
29 29
                 if (!$response->hasHeader('Content-Encoding') || $response->getHeader('Content-Encoding')[0] !== 'gzip') {
30 30
                     throw new ValidationFailedException('gzip compression not active');
Please login to merge, or discard this patch.