@@ -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 | } |
@@ -24,13 +24,13 @@ |
||
| 24 | 24 | |
| 25 | 25 | foreach ($this->checkedHeaders as $headerConfig) { |
| 26 | 26 | if (!$response->hasHeader($headerConfig['key'])) { |
| 27 | - throw new ValidationFailedException('Header not found (' . $headerConfig['key'] . ')'); |
|
| 27 | + throw new ValidationFailedException('Header not found ('.$headerConfig['key'].')'); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $currentValue = $response->getHeader($headerConfig['key'])[0]; |
| 31 | 31 | |
| 32 | - if (!preg_match('%' . $headerConfig['value'] . '%', $currentValue, $matches)) { |
|
| 33 | - throw new ValidationFailedException('Header "' . $headerConfig['key'] . '" does not match "' . $headerConfig['value'] . '". Current value is "' . $currentValue . '"'); |
|
| 32 | + if (!preg_match('%'.$headerConfig['value'].'%', $currentValue, $matches)) { |
|
| 33 | + throw new ValidationFailedException('Header "'.$headerConfig['key'].'" does not match "'.$headerConfig['value'].'". Current value is "'.$currentValue.'"'); |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Psr\Http\Message\ResponseInterface; |
| 6 | 6 | use whm\Html\Document; |
| 7 | -use whm\Smoke\Http\Response; |
|
| 8 | 7 | |
| 9 | 8 | /** |
| 10 | 9 | * This rules counts the css files that are included in a document. If the number is higher |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Psr\Http\Message\ResponseInterface; |
| 6 | 6 | use whm\Html\Document; |
| 7 | -use whm\Smoke\Http\Response; |
|
| 8 | 7 | |
| 9 | 8 | /** |
| 10 | 9 | * This rules counts the js files that are included in a document. If the number is higher |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace whm\Smoke\Rules\Http; |
| 4 | 4 | |
| 5 | 5 | use Psr\Http\Message\ResponseInterface; |
| 6 | -use whm\Smoke\Http\Response; |
|
| 7 | 6 | use whm\Smoke\Rules\Rule; |
| 8 | 7 | |
| 9 | 8 | abstract class HttpsRule implements Rule |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | $sslOptions = stream_context_create(array('ssl' => array('capture_peer_cert' => true))); |
| 25 | 25 | |
| 26 | 26 | $request = @stream_socket_client( |
| 27 | - 'ssl://' . $host . ':443', |
|
| 27 | + 'ssl://'.$host.':443', |
|
| 28 | 28 | $errno, |
| 29 | 29 | $errstr, |
| 30 | 30 | 30, |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace whm\Smoke\Rules\Image; |
| 4 | 4 | |
| 5 | 5 | use Psr\Http\Message\ResponseInterface; |
| 6 | -use whm\Smoke\Http\Response; |
|
| 7 | 6 | use whm\Smoke\Rules\StandardRule; |
| 8 | 7 | |
| 9 | 8 | /** |
@@ -30,8 +30,8 @@ |
||
| 30 | 30 | return; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - $imageHash = md5((string)$response->getBody()); |
|
| 33 | + $imageHash = md5((string) $response->getBody()); |
|
| 34 | 34 | |
| 35 | - $this->assert(!array_key_exists($imageHash, $this->favicons), 'Seems like you use the standard favicon of your framework (' . $this->favicons[$imageHash] . ').'); |
|
| 35 | + $this->assert(!array_key_exists($imageHash, $this->favicons), 'Seems like you use the standard favicon of your framework ('.$this->favicons[$imageHash].').'); |
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use JsonSchema\Validator; |
| 6 | 6 | use Psr\Http\Message\ResponseInterface; |
| 7 | -use whm\Smoke\Http\Response; |
|
| 8 | 7 | use whm\Smoke\Rules\StandardRule; |
| 9 | 8 | use whm\Smoke\Rules\ValidationFailedException; |
| 10 | 9 | |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | protected function doValidation(ResponseInterface $response) |
| 35 | 35 | { |
| 36 | - $data = json_decode((string)$response->getBody()); |
|
| 36 | + $data = json_decode((string) $response->getBody()); |
|
| 37 | 37 | if ($data === null) { |
| 38 | - throw new ValidationFailedException("The given JSON data can not be validated (last error: '" . $this->json_errors[json_last_error()] . "')."); |
|
| 38 | + throw new ValidationFailedException("The given JSON data can not be validated (last error: '".$this->json_errors[json_last_error()]."')."); |
|
| 39 | 39 | } else { |
| 40 | 40 | $errorStatus = false; |
| 41 | 41 | $messageParts = array(); |
@@ -51,14 +51,14 @@ discard block |
||
| 51 | 51 | $errorStatus = true; |
| 52 | 52 | $errorMessage = ''; |
| 53 | 53 | foreach ($validator->getErrors() as $error) { |
| 54 | - $errorMessage = $errorMessage . sprintf("[%s] %s\n", $error['property'], $error['message']); |
|
| 54 | + $errorMessage = $errorMessage.sprintf("[%s] %s\n", $error['property'], $error['message']); |
|
| 55 | 55 | } |
| 56 | - $messageParts[] = $jsonSchemaFile['jsonfilename'] . ' - ' . $jsonSchemaFile['jsonfileurl'] . '(last error: ' . $errorMessage . ').'; |
|
| 56 | + $messageParts[] = $jsonSchemaFile['jsonfilename'].' - '.$jsonSchemaFile['jsonfileurl'].'(last error: '.$errorMessage.').'; |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | if ($errorStatus === true) { |
| 61 | - $message = 'JSON file (' . (string) $response->getUri() . ') does not validate against the following JSON Schema files: ' . implode(', ', $messageParts); |
|
| 61 | + $message = 'JSON file ('.(string) $response->getUri().') does not validate against the following JSON Schema files: '.implode(', ', $messageParts); |
|
| 62 | 62 | throw new ValidationFailedException($message); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -4,8 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Psr\Http\Message\ResponseInterface; |
| 6 | 6 | use Symfony\Component\DomCrawler\Crawler; |
| 7 | -use whm\Smoke\Http\Response; |
|
| 8 | -use whm\Smoke\Rules\Rule; |
|
| 9 | 7 | use whm\Smoke\Rules\StandardRule; |
| 10 | 8 | |
| 11 | 9 | /** |
@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | protected function doValidation(ResponseInterface $response) |
| 21 | 21 | { |
| 22 | - $crawler = new Crawler((string)$response->getBody()); |
|
| 22 | + $crawler = new Crawler((string) $response->getBody()); |
|
| 23 | 23 | $actionNodes = $crawler->filterXPath('//form[//input[@type="password"]]'); |
| 24 | 24 | |
| 25 | - $url = (string)$response->getUri(); |
|
| 25 | + $url = (string) $response->getUri(); |
|
| 26 | 26 | |
| 27 | 27 | foreach ($actionNodes as $node) { |
| 28 | 28 | $action = $node->getAttribute('action'); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | while ($parent = $parent->parentNode) { |
| 38 | 38 | if (property_exists($parent, 'tagName')) { |
| 39 | - $fullPath = $parent->tagName . '/' . $fullPath; |
|
| 39 | + $fullPath = $parent->tagName.'/'.$fullPath; |
|
| 40 | 40 | } else { |
| 41 | 41 | break; |
| 42 | 42 | } |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace whm\Smoke\Rules\Seo; |
| 4 | 4 | |
| 5 | 5 | use Psr\Http\Message\ResponseInterface; |
| 6 | -use whm\Smoke\Http\Response; |
|
| 7 | 6 | use whm\Smoke\Rules\Rule; |
| 8 | 7 | use whm\Smoke\Rules\ValidationFailedException; |
| 9 | 8 | |