@@ -24,9 +24,9 @@ discard block |
||
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 |
||
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 | } |
@@ -38,6 +38,7 @@ discard block |
||
38 | 38 | * @param $status |
39 | 39 | * @param $value |
40 | 40 | * @param $message |
41 | + * @param string $url |
|
41 | 42 | */ |
42 | 43 | public function __construct($status, $message = '', $value = null, $url = null) |
43 | 44 | { |
@@ -56,7 +57,7 @@ discard block |
||
56 | 57 | } |
57 | 58 | |
58 | 59 | /** |
59 | - * @param array $attributes |
|
60 | + * @param array $attribute |
|
60 | 61 | */ |
61 | 62 | public function addAttribute(Attribute $attribute) |
62 | 63 | { |
@@ -109,7 +110,7 @@ discard block |
||
109 | 110 | } |
110 | 111 | |
111 | 112 | /** |
112 | - * @param string $identifier |
|
113 | + * @param string $identifierRule |
|
113 | 114 | */ |
114 | 115 | public function setIdentifierRule($identifierRule) |
115 | 116 | { |
@@ -18,22 +18,22 @@ |
||
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 | } |
@@ -48,13 +48,13 @@ discard block |
||
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 |
||
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); |
@@ -15,9 +15,9 @@ |
||
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 | } |
@@ -28,30 +28,30 @@ discard block |
||
28 | 28 | $client = new GuzzleClient(); |
29 | 29 | $errors = []; |
30 | 30 | |
31 | - $targetUrl = (string)$this->removeCredentials($response->getUri()); |
|
31 | + $targetUrl = (string) $this->removeCredentials($response->getUri()); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | foreach ($this->urls as $url) { |
35 | 35 | $uri = new Uri($url['url']); |
36 | 36 | |
37 | 37 | $urlResponses = $client->sendRequests([new Request('GET', $uri)]); |
38 | - $effectiveUrl = (string)$urlResponses[0]->getEffectiveUri(); |
|
38 | + $effectiveUrl = (string) $urlResponses[0]->getEffectiveUri(); |
|
39 | 39 | |
40 | 40 | if ($effectiveUrl != $targetUrl) { |
41 | - $errors[] = 'The url "' . $url['url'] . '" gets redirected to "' . $effectiveUrl . '".'; |
|
41 | + $errors[] = 'The url "'.$url['url'].'" gets redirected to "'.$effectiveUrl.'".'; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | 45 | if (count($errors) > 0) { |
46 | - $message = 'Not all given urls do redirect to "' . $targetUrl . '"".<ul>'; |
|
46 | + $message = 'Not all given urls do redirect to "'.$targetUrl.'"".<ul>'; |
|
47 | 47 | foreach ($errors as $error) { |
48 | - $message .= '<li>' . $error . '</li>'; |
|
48 | + $message .= '<li>'.$error.'</li>'; |
|
49 | 49 | } |
50 | 50 | $message .= "</ul>"; |
51 | 51 | |
52 | 52 | return new CheckResult(CheckResult::STATUS_FAILURE, $message); |
53 | 53 | } else { |
54 | - return new CheckResult(CheckResult::STATUS_SUCCESS, 'All given urls redirect to ' . (string)$response->getUri()); |
|
54 | + return new CheckResult(CheckResult::STATUS_SUCCESS, 'All given urls redirect to '.(string) $response->getUri()); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | { |
60 | 60 | $query = ''; |
61 | 61 | if ($uri->getQuery()) { |
62 | - $query = "?" . $uri->getQuery(); |
|
62 | + $query = "?".$uri->getQuery(); |
|
63 | 63 | } |
64 | 64 | |
65 | - $plainUri = $uri->getScheme() . '://' . $uri->getHost() . $uri->getPath() . $query; |
|
65 | + $plainUri = $uri->getScheme().'://'.$uri->getHost().$uri->getPath().$query; |
|
66 | 66 | |
67 | 67 | return new Uri($plainUri); |
68 | 68 | } |