Completed
Push — master ( faba57...0b7b7b )
by Nils
02:01
created
src/Extensions/SmokeResponseRetriever/Retriever/ListRetriever/Retriever.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
                     } else {
50 50
                         $uri = new Uri($url);
51 51
                     }
52
-                    $this->urls[(string)$uri] = ['url' => $uri, 'system' => $key];
52
+                    $this->urls[(string) $uri] = ['url' => $uri, 'system' => $key];
53 53
                 }
54 54
             }
55 55
             $this->urlStack = $this->urls;
@@ -109,20 +109,20 @@  discard block
 block discarded – undo
109 109
                     if (strpos($corruptUrl, '/') === 0) {
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 !== '') {
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 
140 140
     public function getOriginUri(UriInterface $uri)
141 141
     {
142
-        if (array_key_exists((string)$uri, $this->redirects)) {
143
-            return $this->urls[$this->redirects[(string)$uri]]['url'];
142
+        if (array_key_exists((string) $uri, $this->redirects)) {
143
+            return $this->urls[$this->redirects[(string) $uri]]['url'];
144 144
         }
145 145
 
146 146
         return $uri;
@@ -153,11 +153,11 @@  discard block
 block discarded – undo
153 153
 
154 154
     public function getSystem(UriInterface $uri)
155 155
     {
156
-        if (array_key_exists((string)$uri, $this->redirects)) {
157
-            return $this->urls[$this->redirects[(string)$uri]]['system'];
156
+        if (array_key_exists((string) $uri, $this->redirects)) {
157
+            return $this->urls[$this->redirects[(string) $uri]]['system'];
158 158
         }
159 159
 
160
-        return $this->urls[(string)$uri]['system'];
160
+        return $this->urls[(string) $uri]['system'];
161 161
     }
162 162
 
163 163
     public function getSystems()
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@
 block discarded – undo
9 9
 use whm\Crawler\Http\RequestFactory;
10 10
 use whm\Html\Uri;
11 11
 use whm\Smoke\Extensions\SmokeResponseRetriever\Retriever\Retriever as SmokeRetriever;
12
-use whm\Smoke\Extensions\SmokeResponseRetriever\RetrieverException;
13 12
 use whm\Smoke\Scanner\SessionContainer;
14 13
 
15 14
 class Retriever implements SmokeRetriever
Please login to merge, or discard this patch.
src/Extensions/SmokeFilter/FilterExtension.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
     public function init($filters = array(), $filterFile = '', $exclusive = array())
43 43
     {
44 44
         if (count($exclusive) > 0 && (count($filters) > 0 || $filterFile !== '')) {
45
-            throw new \RuntimeException("It's not possible to define filter lists and an exclusive list at the same time [Extension: " . get_class($this) . '].');
45
+            throw new \RuntimeException("It's not possible to define filter lists and an exclusive list at the same time [Extension: ".get_class($this).'].');
46 46
         }
47 47
 
48 48
         if ($filterFile !== '') {
49 49
             if (!file_exists($filterFile)) {
50
-                throw new \RuntimeException('Filter file not found: ' . $filterFile);
50
+                throw new \RuntimeException('Filter file not found: '.$filterFile);
51 51
             }
52 52
 
53 53
             $filterElements = EnvAwareYaml::parse(file_get_contents($filterFile));
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 if (is_array($urls)) {
73 73
                     foreach ($urls as $url) {
74 74
                         $uri = new Uri($url);
75
-                        $this->exclusives[$rule][] = (string)$uri;
75
+                        $this->exclusives[$rule][] = (string) $uri;
76 76
                     }
77 77
                 }
78 78
             }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function isFiltered(Event $event, $ruleName, UriAwareResponse $response)
95 95
     {
96
-        $uri = (string)$this->retriever->getOriginUri($response->getUri());
96
+        $uri = (string) $this->retriever->getOriginUri($response->getUri());
97 97
 
98 98
         if ($this->currentModus === self::MODUS_FILTER) {
99 99
             $isFiltered = $this->isFilteredByFilter($ruleName, $uri);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     private function isFilteredByFilter($ruleName, $uri)
113 113
     {
114 114
         foreach ($this->filters as $filter) {
115
-            if ($ruleName === $filter['rule'] && 0 < preg_match('$' . $filter['uri'] . '$', $uri)) {
115
+            if ($ruleName === $filter['rule'] && 0 < preg_match('$'.$filter['uri'].'$', $uri)) {
116 116
                 return true;
117 117
             }
118 118
         }
Please login to merge, or discard this patch.
src/Rules/Html/RegExExistsRule.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
     protected $contentTypes = array('text/html', 'application/json', 'application/xml');
17 17
 
18 18
     /**
19
-     * @param int $string The string that the document must contain
20 19
      */
21 20
     public function init(array $regExs)
22 21
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
             if ($regEx['isRegEx']) {
43 43
                 $pattern = str_replace('', '\\~', $regEx['pattern']);
44 44
 
45
-                if (preg_match('~' . $pattern . '~', (string)$response->getBody()) === 0) {
46
-                    $errors[] = 'Regular expression: ' . $regEx['pattern'];
45
+                if (preg_match('~'.$pattern.'~', (string) $response->getBody()) === 0) {
46
+                    $errors[] = 'Regular expression: '.$regEx['pattern'];
47 47
                 }
48 48
             } else {
49
-                if (preg_match('^' . preg_quote($regEx['pattern']) . '^', (string)$response->getBody()) === 0) {
50
-                    $errors[] = 'Text: ' . $regEx['pattern'];
49
+                if (preg_match('^'.preg_quote($regEx['pattern']).'^', (string) $response->getBody()) === 0) {
50
+                    $errors[] = 'Text: '.$regEx['pattern'];
51 51
                 }
52 52
             }
53 53
         }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             $errorString = 'The following text elements were not found: <ul>';
57 57
 
58 58
             foreach ($errors as $error) {
59
-                $errorString .= '<li>' . $error . '</li>';
59
+                $errorString .= '<li>'.$error.'</li>';
60 60
             }
61 61
 
62 62
             $errorString .= '</ul>';
Please login to merge, or discard this patch.
src/Extensions/SmokeMemory/MemoryExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
         foreach ($results as $result) {
36 36
             /** @var UriAwareResponse $response */
37 37
             if ($result->getStatus() == CheckResult::STATUS_FAILURE) {
38
-                $this->memory[] = (string)$response->getUri();
38
+                $this->memory[] = (string) $response->getUri();
39 39
             }
40 40
         }
41 41
     }
Please login to merge, or discard this patch.
src/Rules/Html/ClosingHtmlTagRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         if ($response instanceof ContentTypeAwareResponse) {
18 18
 
19 19
             // @todo this could be part of the StandardRule class
20
-            $body = (string)$response->getBody();
20
+            $body = (string) $response->getBody();
21 21
             $body = preg_replace('/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F,\xFF,\x8B]/', '', $body);
22 22
 
23 23
             if (($response->getStatusCode() < 300 || $response->getStatusCode() >= 400)
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
                 && strlen($body) > 0
26 26
             ) {
27 27
                 if (stripos($body, '</html>') === false) {
28
-                    throw new ValidationFailedException('Closing html tag is missing (document length: ' . strlen($body) . ').');
28
+                    throw new ValidationFailedException('Closing html tag is missing (document length: '.strlen($body).').');
29 29
                 }
30 30
             }
31 31
         }
Please login to merge, or discard this patch.
src/Rules/Html/InsecureContentRule.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             return;
45 45
         }
46 46
 
47
-        $htmlDocument = new Document((string)$response->getBody());
47
+        $htmlDocument = new Document((string) $response->getBody());
48 48
 
49 49
         $resources = $htmlDocument->getDependencies($uri, false);
50 50
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             if ($resource->getScheme() && 'https' !== $resource->getScheme()) {
55 55
                 $excluded = false;
56 56
                 foreach ($this->excludedFiles as $excludedFile) {
57
-                    if (preg_match('~' . $excludedFile . '~', (string)$resource)) {
57
+                    if (preg_match('~'.$excludedFile.'~', (string) $resource)) {
58 58
                         $excluded = true;
59 59
                         break;
60 60
                     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         if (count($unsecures) > 0) {
69 69
             $message = 'At least one dependency was found on a secure url, that was transfered insecure.<ul>';
70 70
             foreach ($unsecures as $unsecure) {
71
-                $message .= '<li>' . (string)$unsecure . '</li>';
71
+                $message .= '<li>'.(string) $unsecure.'</li>';
72 72
             }
73 73
             $message .= '</ul>';
74 74
             return new CheckResult(CheckResult::STATUS_FAILURE, $message, count($unsecures));
Please login to merge, or discard this patch.
src/Cli/Command/CustomCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
         $configArray = $this->getConfigArray($configFile, true);
51 51
 
52 52
         if (is_string($configArray)) {
53
-            throw new \RuntimeException('Unable to load config file. Please check ' . $configFile);
53
+            throw new \RuntimeException('Unable to load config file. Please check '.$configFile);
54 54
         }
55 55
 
56 56
         $this->config = new Configuration(new Uri('http://www.example.com'), $dispatcher, $configArray);
Please login to merge, or discard this patch.
src/Extensions/SmokeReporter/Reporter/HtmlReporter.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Symfony\Component\Console\Output\OutputInterface;
6 6
 use whm\Smoke\Config\Configuration;
7
-use whm\Smoke\Extensions\SmokeResponseRetriever\Retriever\Retriever;
8 7
 use whm\Smoke\Rules\CheckResult;
9 8
 
10 9
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         $this->resultFile = $resultFile;
29 29
 
30 30
         if ($templateDir === null) {
31
-            $this->templateDir = __DIR__ . '/templates';
31
+            $this->templateDir = __DIR__.'/templates';
32 32
         } else {
33 33
             $this->templateDir = $templateDir;
34 34
         }
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
         }
67 67
 
68 68
         if (!file_put_contents($this->resultFile, $html)) {
69
-            $this->output->writeln("<error>HTML Reporter extension: Could not write result file to " . $this->resultFile ."</error>");
69
+            $this->output->writeln("<error>HTML Reporter extension: Could not write result file to ".$this->resultFile."</error>");
70 70
         } else {
71
-            $this->output->writeln("<info>HTML Reporter extension:</info> Result file written to " . $this->resultFile);
71
+            $this->output->writeln("<info>HTML Reporter extension:</info> Result file written to ".$this->resultFile);
72 72
         }
73 73
     }
74 74
 
Please login to merge, or discard this patch.
src/Extensions/SmokeReporter/Reporter/KoalamonSummaryReporter.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     const STATUS_SUCCESS = 'success';
53 53
     const STATUS_FAILURE = 'failure';
54 54
 
55
-    public function init($apiKey, Configuration $_configuration, OutputInterface $_output, $server = 'https://webhook.koalamon.com', $system = '', $identifier = '', $tool = '', $url ='')
55
+    public function init($apiKey, Configuration $_configuration, OutputInterface $_output, $server = 'https://webhook.koalamon.com', $system = '', $identifier = '', $tool = '', $url = '')
56 56
     {
57 57
         $httpClient = new \GuzzleHttp\Client();
58 58
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     public function processResults($results)
83 83
     {
84 84
         foreach ($results as $result) {
85
-            if($result->getStatus() == CheckResult::STATUS_SUCCESS) {
85
+            if ($result->getStatus() == CheckResult::STATUS_SUCCESS) {
86 86
                 $this->success++;
87 87
             } else {
88 88
                 $this->failed++;
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
     public function finish()
94 94
     {
95 95
         $message = 'Checks: ';
96
-        $message .= $this->success . ' succeeded, ';
97
-        $message .= $this->failed . ' failed. ';
96
+        $message .= $this->success.' succeeded, ';
97
+        $message .= $this->failed.' failed. ';
98 98
 
99 99
         if ($this->failed > 0) {
100 100
             $status = Event::STATUS_FAILURE;
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
                 $this->reporter->sendEvent($event);
130 130
             } catch (KoalamonException $e) {
131 131
                 $this->output->writeln("\n  <error> Error sending result to leankoala. </error>");
132
-                $this->output->writeln('   Url: ' . $e->getUrl());
133
-                $this->output->writeln('   Payload: ' . $e->getPayload());
132
+                $this->output->writeln('   Url: '.$e->getUrl());
133
+                $this->output->writeln('   Payload: '.$e->getPayload());
134 134
                 $this->output->writeln("");
135 135
             } catch (\Exception $e) {
136 136
                 $this->output->writeln($e->getMessage());
Please login to merge, or discard this patch.