@@ -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)) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | private function initConfigArray(array $configArray, array $defaultSettings = null) |
66 | 66 | { |
67 | 67 | if ($defaultSettings === null) { |
68 | - $defaultSettings = Yaml::parse(file_get_contents(__DIR__ . '/../settings/' . self::DEFAULT_SETTINGS)); |
|
68 | + $defaultSettings = Yaml::parse(file_get_contents(__DIR__.'/../settings/'.self::DEFAULT_SETTINGS)); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if (count($configArray) === 0) { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | if ($this->hasSection($section)) { |
168 | 168 | return $this->configArray[$section]; |
169 | 169 | } else { |
170 | - throw new \RuntimeException('The section (' . $section . ') you are trying to access does not exist.'); |
|
170 | + throw new \RuntimeException('The section ('.$section.') you are trying to access does not exist.'); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | if (array_key_exists($name, $this->extensions)) { |
177 | 177 | return $this->extensions[$name]; |
178 | 178 | } else { |
179 | - throw new \RuntimeException('The extension ("' . $name . '") you are trying to access does not exist. Registered extensions are: ' . implode(' ,', array_keys($this->extensions)) . '.'); |
|
179 | + throw new \RuntimeException('The extension ("'.$name.'") you are trying to access does not exist. Registered extensions are: '.implode(' ,', array_keys($this->extensions)).'.'); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | try { |
202 | 202 | $client = Init::initialize($this->configArray['client']); |
203 | 203 | } catch (\Exception $e) { |
204 | - throw new ConfigurationException('Error initializing client (' . $e->getMessage() . ')'); |
|
204 | + throw new ConfigurationException('Error initializing client ('.$e->getMessage().')'); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | if (array_key_exists('cache', $this->configArray['client'])) { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * Result constructor. |
27 | 27 | * |
28 | 28 | * @param $status |
29 | - * @param $value |
|
29 | + * @param integer $value |
|
30 | 30 | * @param $message |
31 | 31 | */ |
32 | 32 | public function __construct($status, $message = '', $value = null) |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | - * @param array $attributes |
|
48 | + * @param array $attribute |
|
49 | 49 | */ |
50 | 50 | public function addAttribute(Attribute $attribute) |
51 | 51 | { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | - * @return mixed |
|
72 | + * @return string |
|
73 | 73 | */ |
74 | 74 | public function getMessage() |
75 | 75 | { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
88 | - * @param Response $response |
|
88 | + * @param ResponseInterface $response |
|
89 | 89 | */ |
90 | 90 | public function setResponse(ResponseInterface $response) |
91 | 91 | { |
@@ -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 |
@@ -4,7 +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 | 7 | use whm\Smoke\Rules\StandardRule; |
9 | 8 | |
10 | 9 | /** |
@@ -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 |
@@ -28,6 +28,10 @@ |
||
28 | 28 | |
29 | 29 | abstract protected function doValidation(ResponseInterface $response); |
30 | 30 | |
31 | + /** |
|
32 | + * @param boolean $valueToBeTrue |
|
33 | + * @param string $errorMessage |
|
34 | + */ |
|
31 | 35 | protected function assert($valueToBeTrue, $errorMessage) |
32 | 36 | { |
33 | 37 | if (!$valueToBeTrue) { |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | public function init($filters = array(), $filterFile = '', $exclusive = array()) |
42 | 42 | { |
43 | 43 | if (count($exclusive) > 0 && (count($filters) > 0 || $filterFile !== '')) { |
44 | - throw new \RuntimeException("It's not possible to define filter lists and an exclusive list at the same time [Extension: " . get_class($this) . '].'); |
|
44 | + throw new \RuntimeException("It's not possible to define filter lists and an exclusive list at the same time [Extension: ".get_class($this).'].'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | if ($filterFile !== '') { |
48 | 48 | if (!file_exists($filterFile)) { |
49 | - throw new \RuntimeException('Filter file not found: ' . $filterFile); |
|
49 | + throw new \RuntimeException('Filter file not found: '.$filterFile); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $filterElements = EnvAwareYaml::parse(file_get_contents($filterFile)); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function isFiltered(Event $event, $ruleName, UriAwareResponse $response) |
87 | 87 | { |
88 | - $uri = (string)$this->retriever->getOriginUri($response->getUri()); |
|
88 | + $uri = (string) $this->retriever->getOriginUri($response->getUri()); |
|
89 | 89 | |
90 | 90 | if ($this->currentModus === self::MODUS_FILTER) { |
91 | 91 | $isFiltered = $this->isFilteredByFilter($ruleName, $uri); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | private function isFilteredByFilter($ruleName, $uri) |
105 | 105 | { |
106 | 106 | foreach ($this->filters as $filter) { |
107 | - if ($ruleName === $filter['rule'] && 0 < preg_match('$' . $filter['uri'] . '$', $uri)) { |
|
107 | + if ($ruleName === $filter['rule'] && 0 < preg_match('$'.$filter['uri'].'$', $uri)) { |
|
108 | 108 | return true; |
109 | 109 | } |
110 | 110 | } |
@@ -109,20 +109,20 @@ discard block |
||
109 | 109 | /* @var \Ivory\HttpAdapter\HttpAdapterException $exception */ |
110 | 110 | |
111 | 111 | $mainUri = $request->getUri(); |
112 | - $this->redirects[(string)$mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl] = (string)$mainUri; |
|
112 | + $this->redirects[(string) $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl] = (string) $mainUri; |
|
113 | 113 | |
114 | - $this->urls[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']]; |
|
115 | - $this->urlStack[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']]; |
|
114 | + $this->urls[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']]; |
|
115 | + $this->urlStack[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']]; |
|
116 | 116 | |
117 | 117 | return $this->next(); |
118 | 118 | } |
119 | 119 | |
120 | 120 | // the error handling should be done withing the calling class |
121 | - echo "\n " . $exception->getMessage() . "\n"; |
|
121 | + echo "\n ".$exception->getMessage()."\n"; |
|
122 | 122 | |
123 | 123 | return $this->next(); |
124 | 124 | } else { |
125 | - $errorMessages .= $exception->getMessage() . "\n"; |
|
125 | + $errorMessages .= $exception->getMessage()."\n"; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | if ($errorMessages !== '') { |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | |
136 | 136 | public function getOriginUri(UriInterface $uri) |
137 | 137 | { |
138 | - if (array_key_exists((string)$uri, $this->redirects)) { |
|
139 | - return $this->urls[$this->redirects[(string)$uri]]['url']; |
|
138 | + if (array_key_exists((string) $uri, $this->redirects)) { |
|
139 | + return $this->urls[$this->redirects[(string) $uri]]['url']; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | return $uri; |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | |
150 | 150 | public function getSystem(UriInterface $uri) |
151 | 151 | { |
152 | - if (array_key_exists((string)$uri, $this->redirects)) { |
|
153 | - return $this->urls[$this->redirects[(string)$uri]]['system']; |
|
152 | + if (array_key_exists((string) $uri, $this->redirects)) { |
|
153 | + return $this->urls[$this->redirects[(string) $uri]]['system']; |
|
154 | 154 | } |
155 | 155 | |
156 | - return $this->urls[(string)$uri]['system']; |
|
156 | + return $this->urls[(string) $uri]['system']; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | public function getSystems() |