Conditions | 10 |
Paths | 42 |
Total Lines | 46 |
Code Lines | 24 |
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 |
||
56 | public function request(Request $request) |
||
57 | { |
||
58 | $request = clone $request; |
||
59 | |||
60 | $cacheKey = implode('.', [ |
||
61 | $request->getMethod(), |
||
62 | $request->getUrl(), |
||
63 | |||
64 | /** @todo This should depend on Vary: header */ |
||
65 | $request->getHeader('Accept'), |
||
66 | $request->getHeader('Accept-Encoding'), |
||
67 | $request->getHeader('Authorization') |
||
68 | ]); |
||
69 | |||
70 | if ($cached = $this->cache->load($cacheKey)) { |
||
71 | if ($this->forbidRecheck) { |
||
72 | $cached = clone $cached; |
||
73 | $this->onResponse && call_user_func($this->onResponse, $cached); |
||
74 | return $cached; |
||
75 | } |
||
76 | |||
77 | /** @var $cached Response */ |
||
78 | if ($cached->hasHeader('Last-Modified')) { |
||
79 | $request->addHeader('If-Modified-Since', $cached->getHeader('Last-Modified')); |
||
80 | } |
||
81 | if ($cached->hasHeader('ETag')) { |
||
82 | $request->addHeader('If-None-Match', $cached->getHeader('ETag')); |
||
83 | } |
||
84 | } |
||
85 | |||
86 | $response = $this->client->request($request); |
||
87 | |||
88 | if ($this->isCacheable($response)) { |
||
89 | $this->cache->save($cacheKey, clone $response); |
||
90 | } |
||
91 | |||
92 | if (isset($cached) && $response->getCode() === Response::S304_NOT_MODIFIED) { |
||
93 | $cached = clone $cached; |
||
94 | |||
95 | /** @todo Should be responses somehow combined into one? */ |
||
96 | $response = $cached->setPrevious($response); |
||
97 | } |
||
98 | |||
99 | $this->onResponse && call_user_func($this->onResponse, $response); |
||
100 | |||
101 | return $response; |
||
102 | } |
||
144 |
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