Completed
Push — master ( 3d9ae5...b7ec6c )
by Nils
04:50 queued 02:22
created
src/Rules/Xml/XmlValidXsdRule.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
     protected function doValidation(ResponseInterface $response)
24 24
     {
25
-        $body = (string)$response->getBody();
25
+        $body = (string) $response->getBody();
26 26
 
27 27
         $dom = new \DOMDocument();
28 28
         @$dom->loadXML($body);
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
                 $error = true;
38 38
                 $lastError = libxml_get_last_error();
39 39
 
40
-                $messageParts[] = $xsdFile['xsdfilename'] . ' - ' . $xsdFile['xsdfileurl'] . ' (last error: ' . str_replace("\n", '', $lastError->message) . ').';
40
+                $messageParts[] = $xsdFile['xsdfilename'].' - '.$xsdFile['xsdfileurl'].' (last error: '.str_replace("\n", '', $lastError->message).').';
41 41
             }
42 42
         }
43 43
 
44 44
         if ($error === true) {
45
-            $message = 'XML file (' . (string)$response->getUri() . ')  does not validate against the following XSD files: ' . implode(', ', $messageParts);
45
+            $message = 'XML file ('.(string) $response->getUri().')  does not validate against the following XSD files: '.implode(', ', $messageParts);
46 46
             throw new ValidationFailedException($message);
47 47
         }
48 48
     }
Please login to merge, or discard this patch.
src/Rules/Json/JsonPathExistsRule.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function doValidation(ResponseInterface $response)
56 56
     {
57
-        $body = (string)$response->getBody();
57
+        $body = (string) $response->getBody();
58 58
 
59 59
         $json = json_decode($body);
60 60
 
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
 
74 74
             if ($jsonValue === false || (is_array($jsonValue) && empty($jsonValue))) {
75 75
                 $error = true;
76
-                $noCorrectJsonPaths[] = $path['pattern'] . ' (JSON path not found)';
76
+                $noCorrectJsonPaths[] = $path['pattern'].' (JSON path not found)';
77 77
             }
78
-            if ($this->checkRelation($path['relation'], (int)$path['value'], $count) === false) {
78
+            if ($this->checkRelation($path['relation'], (int) $path['value'], $count) === false) {
79 79
                 $error = true;
80
-                $noCorrectJsonPaths[] = $path['pattern'] . ' (' . $count . ' elements found, expected ' . $path['relation'] . ' ' . $path['value'] . ')';
80
+                $noCorrectJsonPaths[] = $path['pattern'].' ('.$count.' elements found, expected '.$path['relation'].' '.$path['value'].')';
81 81
             }
82 82
         }
83 83
 
84 84
         if ($error === true) {
85 85
             $allNoCorrectJsonPaths = implode('", "', $noCorrectJsonPaths);
86
-            throw new ValidationFailedException('Disonances with JSON Paths "' . $allNoCorrectJsonPaths . '!');
86
+            throw new ValidationFailedException('Disonances with JSON Paths "'.$allNoCorrectJsonPaths.'!');
87 87
         }
88 88
     }
89 89
 }
Please login to merge, or discard this patch.
src/Rules/Xml/Rss/ValidRule.php 2 patches
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\Rss;
4 4
 
5 5
 use Psr\Http\Message\ResponseInterface;
6
-use whm\Smoke\Rules\Rule;
7 6
 use whm\Smoke\Rules\StandardRule;
8 7
 use whm\Smoke\Rules\ValidationFailedException;
9 8
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 
19 19
     private function getSchema()
20 20
     {
21
-        return __DIR__ . '/' . self::SCHEMA;
21
+        return __DIR__.'/'.self::SCHEMA;
22 22
     }
23 23
 
24 24
     public function doValidation(ResponseInterface $response)
25 25
     {
26
-        $body = (string)$response->getBody();
26
+        $body = (string) $response->getBody();
27 27
         if (preg_match('/<rss/', $body)) {
28 28
             libxml_clear_errors();
29 29
             $dom = new \DOMDocument();
@@ -31,16 +31,16 @@  discard block
 block discarded – undo
31 31
             $lastError = libxml_get_last_error();
32 32
             if ($lastError) {
33 33
                 throw new ValidationFailedException(
34
-                    'The given xml file is not well formed (last error: ' .
35
-                    str_replace("\n", '', $lastError->message) . ').');
34
+                    'The given xml file is not well formed (last error: '.
35
+                    str_replace("\n", '', $lastError->message).').');
36 36
             }
37 37
             $valid = @$dom->schemaValidate($this->getSchema());
38 38
             if (!$valid) {
39 39
                 $lastError = libxml_get_last_error();
40 40
                 $lastErrorMessage = str_replace("\n", '', $lastError->message);
41 41
                 throw new ValidationFailedException(
42
-                    'The given xml file is not a valid rss file (last error: ' .
43
-                    $lastErrorMessage . ').');
42
+                    'The given xml file is not a valid rss file (last error: '.
43
+                    $lastErrorMessage.').');
44 44
             }
45 45
         }
46 46
     }
Please login to merge, or discard this patch.
src/Rules/CheckResult.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     }
45 45
 
46 46
     /**
47
-     * @param array $attributes
47
+     * @param array $attribute
48 48
      */
49 49
     public function addAttribute(Attribute $attribute)
50 50
     {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     }
69 69
 
70 70
     /**
71
-     * @return mixed
71
+     * @return string
72 72
      */
73 73
     public function getMessage()
74 74
     {
Please login to merge, or discard this patch.
src/Rules/Http/HttpsCertificateExpireRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         } else {
32 32
 
33 33
             if ($certInfo['validFrom_time_t'] > time() || $certInfo['validTo_time_t'] < time()) {
34
-                $errorMessage = 'Certificate is expired. [' . $validFrom . ' - ' . $validTo . ']';
34
+                $errorMessage = 'Certificate is expired. ['.$validFrom.' - '.$validTo.']';
35 35
 
36 36
                 $result = new CheckResult(CheckResult::STATUS_FAILURE, $errorMessage);
37 37
                 $infoJson = json_encode($certInfo);
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
                     $result->addAttribute(new Attribute('certificate information', $infoJson, true));
42 42
                 }
43 43
                 return $result;
44
-            } elseif ($certInfo['validTo_time_t'] < strtotime('+' . $this->expireWarningTime . 'days')) {
45
-                $errorMessage = 'Certificate warning, expires in less than ' . $this->expireWarningTime . ' days. Certificate expires at: ' . $validTo;
44
+            } elseif ($certInfo['validTo_time_t'] < strtotime('+'.$this->expireWarningTime.'days')) {
45
+                $errorMessage = 'Certificate warning, expires in less than '.$this->expireWarningTime.' days. Certificate expires at: '.$validTo;
46 46
 
47 47
                 $result = new CheckResult(CheckResult::STATUS_FAILURE, $errorMessage);
48 48
                 $result->addAttribute(new Attribute('certificate information', json_encode($certInfo), true));
@@ -50,6 +50,6 @@  discard block
 block discarded – undo
50 50
             }
51 51
         }
52 52
 
53
-        return new CheckResult(CheckResult::STATUS_SUCCESS, 'The certificate does not expire within the next ' . $this->expireWarningTime . ' days. Expire date: ' . $validTo . '.');
53
+        return new CheckResult(CheckResult::STATUS_SUCCESS, 'The certificate does not expire within the next '.$this->expireWarningTime.' days. Expire date: '.$validTo.'.');
54 54
     }
55 55
 }
Please login to merge, or discard this patch.
src/Extensions/SmokeResponseRetriever/Retriever/ListRetriever/Retriever.php 1 patch
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.
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.