@@ -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 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | - * @param $section |
|
| 161 | + * @param string $section |
|
| 162 | 162 | * |
| 163 | 163 | * @return array |
| 164 | 164 | */ |
@@ -171,6 +171,9 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | + /** |
|
| 175 | + * @param string $name |
|
| 176 | + */ |
|
| 174 | 177 | public function getExtension($name) |
| 175 | 178 | { |
| 176 | 179 | if (array_key_exists($name, $this->extensions)) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | private function initConfigArray(array $configArray, array $defaultSettings = null) |
| 68 | 68 | { |
| 69 | 69 | if ($defaultSettings === null) { |
| 70 | - $defaultSettings = Yaml::parse(file_get_contents(__DIR__ . '/../settings/' . self::DEFAULT_SETTINGS)); |
|
| 70 | + $defaultSettings = Yaml::parse(file_get_contents(__DIR__.'/../settings/'.self::DEFAULT_SETTINGS)); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | if (count($configArray) === 0) { |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | if ($this->hasSection($section)) { |
| 170 | 170 | return $this->configArray[$section]; |
| 171 | 171 | } else { |
| 172 | - throw new \RuntimeException('The section (' . $section . ') you are trying to access does not exist.'); |
|
| 172 | + throw new \RuntimeException('The section ('.$section.') you are trying to access does not exist.'); |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | if (array_key_exists($name, $this->extensions)) { |
| 179 | 179 | return $this->extensions[$name]; |
| 180 | 180 | } else { |
| 181 | - throw new \RuntimeException('The extension ("' . $name . '") you are trying to access does not exist. Registered extensions are: ' . implode(' ,', array_keys($this->extensions)) . '.'); |
|
| 181 | + throw new \RuntimeException('The extension ("'.$name.'") you are trying to access does not exist. Registered extensions are: '.implode(' ,', array_keys($this->extensions)).'.'); |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | try { |
| 204 | 204 | $client = Init::initialize($this->configArray['client']); |
| 205 | 205 | } catch (\Exception $e) { |
| 206 | - throw new ConfigurationException('Error initializing client (' . $e->getMessage() . ')'); |
|
| 206 | + throw new ConfigurationException('Error initializing client ('.$e->getMessage().')'); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | return $client; |
@@ -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 | } |