Conditions | 11 |
Paths | 10 |
Total Lines | 32 |
Code Lines | 13 |
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 |
||
87 | protected function extractMultipart(Request $request, $values) { |
||
88 | // The request body parameters might contain file upload mutations. We treat |
||
89 | // them according to the graphql multipart request specification. |
||
90 | // |
||
91 | // @see https://github.com/jaydenseric/graphql-multipart-request-spec#server |
||
92 | if ($body = JsonHelper::decodeParams($request->request->all())) { |
||
93 | // Flatten the operations array if it exists. |
||
94 | $operations = isset($body['operations']) && is_array($body['operations']) ? $body['operations'] : []; |
||
95 | $values = array_merge($values, $body, $operations); |
||
96 | } |
||
97 | |||
98 | // According to the graphql multipart request specification, uploaded files |
||
99 | // are referenced to variable placeholders in a map. Here, we resolve this |
||
100 | // map by assigning the uploaded files to the corresponding variables. |
||
101 | if (!empty($values['map']) && is_array($values['map']) && $files = $request->files->all()) { |
||
102 | foreach ($files as $key => $file) { |
||
103 | if (!isset($values['map'][$key])) { |
||
104 | continue; |
||
105 | } |
||
106 | |||
107 | $paths = (array) $values['map'][$key]; |
||
108 | foreach ($paths as $path) { |
||
109 | $path = explode('.', $path); |
||
110 | |||
111 | if (NestedArray::keyExists($values, $path)) { |
||
112 | NestedArray::setValue($values, $path, $file); |
||
113 | } |
||
114 | } |
||
115 | } |
||
116 | } |
||
117 | |||
118 | return $values; |
||
119 | } |
||
122 |
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