Conditions | 1 |
Paths | 1 |
Total Lines | 63 |
Code Lines | 59 |
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 |
||
57 | public function persianSlug(string $string, string $separator = '-') |
||
58 | { |
||
59 | $_transliteration = array( |
||
60 | '/ä|æ|ǽ/' => 'ae', |
||
61 | '/ö|œ/' => 'oe', |
||
62 | '/ü/' => 'ue', |
||
63 | '/Ä/' => 'Ae', |
||
64 | '/Ü/' => 'Ue', |
||
65 | '/Ö/' => 'Oe', |
||
66 | '/À|Á|Â|Ã|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A', |
||
67 | '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a', |
||
68 | '/Ç|Ć|Ĉ|Ċ|Č/' => 'C', |
||
69 | '/ç|ć|ĉ|ċ|č/' => 'c', |
||
70 | '/Ð|Ď|Đ/' => 'D', |
||
71 | '/ð|ď|đ/' => 'd', |
||
72 | '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E', |
||
73 | '/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e', |
||
74 | '/Ĝ|Ğ|Ġ|Ģ/' => 'G', |
||
75 | '/ĝ|ğ|ġ|ģ/' => 'g', |
||
76 | '/Ĥ|Ħ/' => 'H', |
||
77 | '/ĥ|ħ/' => 'h', |
||
78 | '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I', |
||
79 | '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i', |
||
80 | '/Ĵ/' => 'J', |
||
81 | '/ĵ/' => 'j', |
||
82 | '/Ķ/' => 'K', |
||
83 | '/ķ/' => 'k', |
||
84 | '/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s}]+/mu' => $separator, |
||
115 | sprintf('/^[%s]+|[%s]+$/', $quotedReplacement, $quotedReplacement) => '', |
||
116 | ); |
||
117 | $map = $_transliteration + $merge; |
||
118 | unset($_transliteration); |
||
119 | return mb_strtolower(preg_replace(array_keys($map), array_values($map), $string)); |
||
120 | } |
||
174 |
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