@@ -63,7 +63,7 @@ |
||
63 | 63 | |
64 | 64 | $results = $this->checkResponse($response); |
65 | 65 | |
66 | - if(count($results) == 0) { |
|
66 | + if (count($results) == 0) { |
|
67 | 67 | $checkResult = new CheckResult(CheckResult::STATUS_NONE, ''); |
68 | 68 | $checkResult->setResponse($response); |
69 | 69 | $results = [$checkResult]; |
@@ -22,14 +22,14 @@ |
||
22 | 22 | if (count($results) > 0) { |
23 | 23 | ++$this->urlCount; |
24 | 24 | $firstResult = array_pop($results); |
25 | - $this->output->writeln(' ' . (string)$firstResult->getResponse()->getUri()); |
|
25 | + $this->output->writeln(' '.(string) $firstResult->getResponse()->getUri()); |
|
26 | 26 | $this->output->writeln(''); |
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | 30 | public function finish() |
31 | 31 | { |
32 | - $this->output->writeln(' <comment>Warm up finished. ' . $this->urlCount . ' urls visited.</comment>'); |
|
32 | + $this->output->writeln(' <comment>Warm up finished. '.$this->urlCount.' urls visited.</comment>'); |
|
33 | 33 | $this->output->writeln(''); |
34 | 34 | } |
35 | 35 | } |
@@ -43,6 +43,11 @@ |
||
43 | 43 | return json_decode($systems->getBody(), true); |
44 | 44 | } |
45 | 45 | |
46 | + /** |
|
47 | + * @param string $url |
|
48 | + * |
|
49 | + * @return string |
|
50 | + */ |
|
46 | 51 | private function prepareUrl($url) |
47 | 52 | { |
48 | 53 | $preparedUrl = str_replace('#project#', $this->project, $url); |
@@ -73,17 +73,17 @@ |
||
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 | } |
@@ -31,15 +31,15 @@ |
||
31 | 31 | |
32 | 32 | if ($xpath['relation'] === 'equals') { |
33 | 33 | $result = $count === (int) $xpath['value']; |
34 | - $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were exact ' . $xpath['value'] . ' occurencies.'; |
|
34 | + $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were exact '.$xpath['value'].' occurencies.'; |
|
35 | 35 | } elseif ($xpath['relation'] === 'less than') { |
36 | 36 | $result = $count < (int) $xpath['value']; |
37 | - $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were less than ' . $xpath['value'] . '.'; |
|
37 | + $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were less than '.$xpath['value'].'.'; |
|
38 | 38 | } elseif ($xpath['relation'] === 'greater than') { |
39 | 39 | $result = $count > (int) $xpath['value']; |
40 | - $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were more than ' . $xpath['value'] . '.'; |
|
40 | + $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were more than '.$xpath['value'].'.'; |
|
41 | 41 | } else { |
42 | - throw new \RuntimeException('Relation not defined. Given "' . $xpath['relation'] . '" expected [equals, greater than, less than]'); |
|
42 | + throw new \RuntimeException('Relation not defined. Given "'.$xpath['relation'].'" expected [equals, greater than, less than]'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $this->assert($result, $message); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | private function getEndpoint(Uri $uri) |
16 | 16 | { |
17 | 17 | // return str_replace('#url#', urlencode('https://webhook.koalamon.com'), self::ENDPOINT); |
18 | - return str_replace('#url#', urlencode((string)$uri), self::ENDPOINT); |
|
18 | + return str_replace('#url#', urlencode((string) $uri), self::ENDPOINT); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function validate(Response $response) |
@@ -34,15 +34,15 @@ discard block |
||
34 | 34 | ))); |
35 | 35 | |
36 | 36 | if (property_exists($result, 'error')) { |
37 | - throw new ValidationFailedException('Google mobile friendly test was not passed. Error "' . $result->error->message . '"'); |
|
37 | + throw new ValidationFailedException('Google mobile friendly test was not passed. Error "'.$result->error->message.'"'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $passResult = $result->ruleGroups->USABILITY; |
41 | 41 | |
42 | 42 | if (!$passResult->pass) { |
43 | - return new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Score ' . $passResult->score . '/100.', (int)$passResult->score); |
|
43 | + return new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Score '.$passResult->score.'/100.', (int) $passResult->score); |
|
44 | 44 | } |
45 | 45 | |
46 | - return new CheckResult(CheckResult::STATUS_SUCCESS, 'Google mobile friendly test passed. Score ' . $passResult->score . '/100.', (int)$passResult->score); |
|
46 | + return new CheckResult(CheckResult::STATUS_SUCCESS, 'Google mobile friendly test passed. Score '.$passResult->score.'/100.', (int) $passResult->score); |
|
47 | 47 | } |
48 | 48 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | { |
24 | 24 | if (array_key_exists('issuer', $certInfo) and array_key_exists('CN', $certInfo['issuer'])) { |
25 | 25 | if ($certInfo['issuer']['CN'] !== $this->authorityName) { |
26 | - throw new ValidationFailedException('Expected authority was "' . $this->authorityName . '", "' . $certInfo['issuer']['CN'] . '" found.'); |
|
26 | + throw new ValidationFailedException('Expected authority was "'.$this->authorityName.'", "'.$certInfo['issuer']['CN'].'" found.'); |
|
27 | 27 | } |
28 | 28 | } else { |
29 | - throw new ValidationFailedException('Expected authority was "' . $this->authorityName . '". No authority found.'); |
|
29 | + throw new ValidationFailedException('Expected authority was "'.$this->authorityName.'". No authority found.'); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | } |
@@ -12,10 +12,10 @@ |
||
12 | 12 | |
13 | 13 | foreach ($matches[1] as $varName) { |
14 | 14 | if (!getenv($varName)) { |
15 | - throw new \RuntimeException('The mandatory env variable (' . $varName . ') from the config file was not set.'); |
|
15 | + throw new \RuntimeException('The mandatory env variable ('.$varName.') from the config file was not set.'); |
|
16 | 16 | } |
17 | 17 | |
18 | - $fileContent = str_replace('${' . $varName . '}', getenv($varName), $fileContent); |
|
18 | + $fileContent = str_replace('${'.$varName.'}', getenv($varName), $fileContent); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | return Yaml::parse($fileContent); |
@@ -27,13 +27,13 @@ |
||
27 | 27 | if ($response->getDuration() > $this->maxDuration) { |
28 | 28 | return new CheckResult( |
29 | 29 | CheckResult::STATUS_FAILURE, |
30 | - 'The http request took ' . (int) $response->getDuration() . ' milliseconds (limit was ' . $this->maxDuration . 'ms).', |
|
30 | + 'The http request took '.(int) $response->getDuration().' milliseconds (limit was '.$this->maxDuration.'ms).', |
|
31 | 31 | (int) $response->getDuration()); |
32 | 32 | } |
33 | 33 | |
34 | 34 | return new CheckResult( |
35 | 35 | CheckResult::STATUS_SUCCESS, |
36 | - 'The http request took ' . (int) $response->getDuration() . ' milliseconds.', |
|
36 | + 'The http request took '.(int) $response->getDuration().' milliseconds.', |
|
37 | 37 | (int) $response->getDuration()); |
38 | 38 | } |
39 | 39 | } |