Completed
Push — master ( 627ed2...ed3594 )
by Nils
02:43
created
src/Rules/Xml/XmlValidXsdRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@  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);
29 29
 
30
-        $filename = (string)$response->getUri();
30
+        $filename = (string) $response->getUri();
31 31
 
32 32
         $error = false;
33 33
         $messageParts = array();
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
                 $error = true;
40 40
                 $lastError = libxml_get_last_error();
41 41
 
42
-                $messageParts[] = $xsdFile['xsdfilename'] . ' - ' . $xsdFile['xsdfileurl'] . '(last error: ' . str_replace("\n", '', $lastError->message) . ').';
42
+                $messageParts[] = $xsdFile['xsdfilename'].' - '.$xsdFile['xsdfileurl'].'(last error: '.str_replace("\n", '', $lastError->message).').';
43 43
             }
44 44
         }
45 45
 
46 46
         if ($error === true) {
47
-            $message = 'XML file (' . $filename . ')  does not validate against the following XSD files: ' . implode(', ', $messageParts);
47
+            $message = 'XML file ('.$filename.')  does not validate against the following XSD files: '.implode(', ', $messageParts);
48 48
             throw new ValidationFailedException($message);
49 49
         }
50 50
     }
Please login to merge, or discard this patch.
src/Rules/Xml/DuplicateIdRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
             return;
19 19
         }
20 20
 
21
-        $crawler = new Crawler((string)$response->getBody());
21
+        $crawler = new Crawler((string) $response->getBody());
22 22
 
23 23
         $idList = $crawler->filterXPath('//*[@id!=""]');
24 24
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         if (count($duplicatedIds) > 0) {
38 38
             unset($duplicatedIds['']);
39
-            throw new ValidationFailedException('Duplicate ids found (' . implode(', ', array_keys($duplicatedIds)) . ')');
39
+            throw new ValidationFailedException('Duplicate ids found ('.implode(', ', array_keys($duplicatedIds)).')');
40 40
         }
41 41
     }
42 42
 }
Please login to merge, or discard this patch.
src/Rules/Json/ValidRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
 
27 27
     public function doValidation(ResponseInterface $response)
28 28
     {
29
-        $result = json_decode((string)$response->getBody());
29
+        $result = json_decode((string) $response->getBody());
30 30
         if ($result === null) {
31
-            throw new ValidationFailedException("The given JSON data can not be validated (last error: '" . $this->json_errors[json_last_error()] . "').");
31
+            throw new ValidationFailedException("The given JSON data can not be validated (last error: '".$this->json_errors[json_last_error()]."').");
32 32
         }
33 33
     }
34 34
 }
Please login to merge, or discard this patch.
src/Rules/Json/JsonPathExistsRule.php 1 patch
Spacing   +4 added lines, -4 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 78
             if ($this->checkRelation($path['relation'], $path['value'], $count) === false) {
79 79
                 $error = true;
80
-                $noCorrectJsonPaths[] = $path['pattern'] . ' (number of JSONPaths is not correct corresponding to the given relation/value)';
80
+                $noCorrectJsonPaths[] = $path['pattern'].' (number of JSONPaths is not correct corresponding to the given relation/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/Html/ForeignDomainImageRule.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     protected function doValidation(ResponseInterface $response)
28 28
     {
29
-        $document = new Document((string)$response->getBody());
29
+        $document = new Document((string) $response->getBody());
30 30
         $images = $document->getImages($response->getUri());
31 31
 
32 32
         $foreignImages = array();
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
         foreach ($images as $image) {
38 38
             /* @var $image Uri */
39 39
             if ($currentUri->getHost($this->depth) !== $image->getHost($this->depth)) {
40
-                $foreignImages[] = (string)$image;
40
+                $foreignImages[] = (string) $image;
41 41
             }
42 42
         }
43 43
 
44
-        $this->assert(count($foreignImages) === 0, 'Images from a foreign domain where found (' . implode(', ', $foreignImages) . ')');
44
+        $this->assert(count($foreignImages) === 0, 'Images from a foreign domain where found ('.implode(', ', $foreignImages).')');
45 45
     }
46 46
 }
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
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
     {
17 17
         if ($response instanceof ContentTypeAwareResponse) {
18 18
             if (($response->getStatusCode() < 300 || $response->getStatusCode() >= 400) && $response->getContentType() === 'text/html') {
19
-                if (stripos((string)$response->getBody(), '</html>') === false) {
20
-                    throw new ValidationFailedException('Closing html tag is missing (document lengh: ' . strlen((string)$response->getBody()) . ').');
19
+                if (stripos((string) $response->getBody(), '</html>') === false) {
20
+                    throw new ValidationFailedException('Closing html tag is missing (document lengh: '.strlen((string) $response->getBody()).').');
21 21
                 }
22 22
             }
23 23
         }
Please login to merge, or discard this patch.
src/Rules/Html/InvalidUrlsRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 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
 
23 23
         $urls = $document->getDependencies($response->getUri());
24 24
 
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 
28 28
         foreach ($urls as $url) {
29 29
 
30
-            $idnUrl = $url->getScheme() . '://' . idn_to_ascii($url->getHost()) .  $url->getPath();
30
+            $idnUrl = $url->getScheme().'://'.idn_to_ascii($url->getHost()).$url->getPath();
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/Rules/Html/SizeRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
     protected function doValidation(ResponseInterface $response)
27 27
     {
28
-        $size = strlen((string)$response->getBody()) / 1000;
29
-        $this->assert($size <= $this->maxSize, 'The size of this html file is too big (' . $size . ' KB)');
28
+        $size = strlen((string) $response->getBody()) / 1000;
29
+        $this->assert($size <= $this->maxSize, 'The size of this html file is too big ('.$size.' KB)');
30 30
     }
31 31
 }
Please login to merge, or discard this patch.
src/Rules/Html/StringNotExistsRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 
25 25
     public function doValidation(ResponseInterface $response)
26 26
     {
27
-        $this->assert(strpos((string)$response->getBody(), $this->string) !== false,
28
-            'The given string (' . $this->string . ') was found in this document.');
27
+        $this->assert(strpos((string) $response->getBody(), $this->string) !== false,
28
+            'The given string ('.$this->string.') was found in this document.');
29 29
     }
30 30
 }
Please login to merge, or discard this patch.