| Conditions | 1 |
| Total Lines | 65 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 102 | private function mockResponse(): ResponseInterface |
||
| 103 | { |
||
| 104 | $c = new class implements ResponseInterface |
||
| 105 | { |
||
| 106 | public function getStatusCode() |
||
| 107 | { |
||
| 108 | return 200; |
||
| 109 | } |
||
| 110 | public function getBody() |
||
| 111 | { |
||
| 112 | return json_encode([ |
||
| 113 | 'author_url' => 'https://www.youtube.com/channel/UCR2KG2dK1tAkwZZjm7rAiSg', |
||
| 114 | 'thumbnail_width' => 480, |
||
| 115 | 'title' => 'Try to stay SERIOUS -The most popular CAT videos', |
||
| 116 | 'width' => 480, |
||
| 117 | 'provider_name' => 'YouTube', |
||
| 118 | 'author_name' => 'Tiger Funnies', |
||
| 119 | 'height' => 270, |
||
| 120 | 'version' => '1.0', |
||
| 121 | 'type' => 'video', |
||
| 122 | // phpcs:ignore |
||
| 123 | 'html' => '<iframe width="480" height="270" src="https://www.youtube.com/embed/iRXJXaLV0n4?feature=oembed" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>', |
||
| 124 | 'provider_url' => 'https://www.youtube.com/', |
||
| 125 | 'thumbnail_height' => 360, |
||
| 126 | 'thumbnail_url' => 'https://i.ytimg.com/vi/iRXJXaLV0n4/hqdefault.jpg', |
||
| 127 | ]); |
||
| 128 | } |
||
| 129 | public function withStatus($code, $reasonPhrase = '') |
||
| 130 | { |
||
| 131 | } |
||
| 132 | public function getReasonPhrase() |
||
| 133 | { |
||
| 134 | } |
||
| 135 | public function getProtocolVersion() |
||
| 136 | { |
||
| 137 | } |
||
| 138 | public function withProtocolVersion($version) |
||
| 139 | { |
||
| 140 | } |
||
| 141 | public function getHeaders() |
||
| 142 | { |
||
| 143 | } |
||
| 144 | public function hasHeader($name) |
||
| 145 | { |
||
| 146 | } |
||
| 147 | public function getHeader($name) |
||
| 148 | { |
||
| 149 | } |
||
| 150 | public function getHeaderLine($name) |
||
| 151 | { |
||
| 152 | } |
||
| 153 | public function withHeader($name, $value) |
||
| 154 | { |
||
| 155 | } |
||
| 156 | public function withAddedHeader($name, $value) |
||
| 157 | { |
||
| 158 | } |
||
| 159 | public function withoutHeader($name) |
||
| 160 | { |
||
| 161 | } |
||
| 162 | public function withBody(StreamInterface $body) |
||
| 163 | { |
||
| 164 | } |
||
| 165 | }; |
||
| 166 | return new $c(); |
||
| 167 | } |
||
| 169 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths