Conditions | 66 |
Paths | 58 |
Total Lines | 146 |
Code Lines | 92 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
92 | protected function generateCoins(array $metadata) |
||
93 | { |
||
94 | |||
95 | // The output follows the "Brief guide to Implementing OpenURL 1.0 Context Object for Journal Articles" |
||
96 | // -> https://archive.is/a0Hgs |
||
97 | |||
98 | // Formal specification of COinS |
||
99 | $coins = 'url_ver=Z39.88-2004'; |
||
100 | $coins .= '&ctx_ver=Z39.88-2004'; |
||
101 | |||
102 | // TODO: Get the document type to differentiate info:ofi/fmt:kev:mtx:[book/journal] and rft.genre=[…] |
||
103 | $coins .= '&rft_val_fmt='. urlencode('info:ofi/fmt:kev:mtx:journal'); |
||
104 | $coins .= '&rft.genre=unknown'; |
||
105 | |||
106 | foreach ($metadata as $index_name => $values) { |
||
107 | if (preg_match("/^author[[:digit:]]+/", $index_name)) { |
||
108 | if (is_array($values)) { |
||
109 | foreach ($values as $id => $value) { |
||
110 | if ($value) { |
||
111 | $coins .= '&rft.au=' . urlencode($value); |
||
112 | } |
||
113 | } |
||
114 | } |
||
115 | continue; |
||
116 | } |
||
117 | |||
118 | if (preg_match("/^publisher[[:digit:]]+/", $index_name)) { |
||
119 | if (is_array($values)) { |
||
120 | foreach ($values as $id => $value) { |
||
121 | if ($value) { |
||
122 | $coins .= '&rft.pub=' . urlencode($value); |
||
123 | } |
||
124 | } |
||
125 | } |
||
126 | continue; |
||
127 | } |
||
128 | |||
129 | switch ($index_name) { |
||
130 | case 'record_id': |
||
131 | if (is_array($values) && $values[0]) { |
||
132 | $coins .= '&rfr_id=info:sid/qucosa.de:' . urlencode($values[0]); |
||
133 | } |
||
134 | break; |
||
135 | |||
136 | case 'urn': |
||
137 | case 'original_urn': |
||
138 | case 'series_urn': |
||
139 | case 'multivolume_urn': |
||
140 | case 'doi': |
||
141 | case 'original_doi': |
||
142 | if (is_array($values) && $values[0]) { |
||
143 | $coins .= '&rft_id=' . urlencode($values[0]); |
||
144 | } |
||
145 | break; |
||
146 | |||
147 | case 'isbn': |
||
148 | case 'original_isbn': |
||
149 | if (is_array($values) && $values[0]) { |
||
150 | $coins .= '&rft.isbn=' . urlencode($values[0]); |
||
151 | } |
||
152 | break; |
||
153 | |||
154 | case 'issn': |
||
155 | case 'original_issn': |
||
156 | if (is_array($values) && $values[0]) { |
||
157 | $coins .= '&rft.issn=' . urlencode($values[0]); |
||
158 | } |
||
159 | break; |
||
160 | |||
161 | case 'title': |
||
162 | if (is_array($values) && $values[0]) { |
||
163 | $coins .= '&rft.atitle=' . urlencode($values[0]); |
||
164 | } |
||
165 | break; |
||
166 | |||
167 | case 'original_subtitle': |
||
168 | if (is_array($values) && $values[0]) { |
||
169 | $coins .= '&rft.stitle=' . urlencode($values[0]); |
||
170 | } |
||
171 | break; |
||
172 | |||
173 | case 'original_title': |
||
174 | if (is_array($values) && $values[0]) { |
||
175 | $coins .= '&rft.jtitle=' . urlencode($values[0]); |
||
176 | } |
||
177 | break; |
||
178 | |||
179 | case 'original_pages': |
||
180 | if (is_array($values) && $values[0]) { |
||
181 | $coins .= '&rft.spage=' . urlencode($values[0]); |
||
182 | } |
||
183 | break; |
||
184 | |||
185 | case 'original_pages2': |
||
186 | if (is_array($values) && $values[0]) { |
||
187 | $coins .= '&rft.epage=' . urlencode($values[0]); |
||
188 | } |
||
189 | break; |
||
190 | |||
191 | case 'issue': |
||
192 | case 'original_issue': |
||
193 | if (is_array($values) && $values[0]) { |
||
194 | $coins .= '&rft.issue=' . urlencode($values[0]); |
||
195 | } |
||
196 | break; |
||
197 | |||
198 | case 'volume': |
||
199 | case 'original_volume': |
||
200 | if (is_array($values) && $values[0]) { |
||
201 | $coins .= '&rft.volume=' . urlencode($values[0]); |
||
202 | } |
||
203 | break; |
||
204 | |||
205 | case 'original_corporation_publisher': |
||
206 | if (is_array($values) && $values[0]) { |
||
207 | $coins .= '&rft.pub=' . urlencode($values[0]); |
||
208 | } |
||
209 | break; |
||
210 | |||
211 | case 'place': |
||
212 | case 'original_place': |
||
213 | if (is_array($values) && $values[0]) { |
||
214 | if ($values[0]) { |
||
215 | $coins .= '&rft.place=' . urlencode($values[0]); |
||
216 | } |
||
217 | } |
||
218 | break; |
||
219 | |||
220 | case 'dateissued': |
||
221 | if (is_array($values) && $values[0]) { |
||
222 | $coins .= '&rft.date=' . urlencode($this->safelyFormatDate("Y/m/d", $values[0])); |
||
223 | } |
||
224 | break; |
||
225 | |||
226 | case 'language': |
||
227 | if (is_array($values) && $values[0]) { |
||
228 | $coins .= '&rft.language=' . urlencode($values[0]); |
||
229 | } |
||
230 | break; |
||
231 | |||
232 | default: |
||
233 | break; |
||
234 | } |
||
235 | } |
||
236 | |||
237 | return '<span class="Z3988" title="' . $coins . '"></span>'; |
||
238 | } |
||
255 |
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