Conditions | 11 |
Paths | 11 |
Total Lines | 31 |
Code Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | 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 |
||
18 | public static function getCurveByName(string $name): NamedCurveFp |
||
19 | { |
||
20 | $adapter = MathAdapterFactory::getAdapter(); |
||
21 | $nistFactory = self::getNistFactory($adapter); |
||
22 | $secpFactory = self::getSecpFactory($adapter); |
||
23 | |||
24 | switch ($name) { |
||
25 | case NistCurve::NAME_P192: |
||
26 | return $nistFactory->curve192(); |
||
27 | case NistCurve::NAME_P224: |
||
28 | return $nistFactory->curve224(); |
||
29 | case NistCurve::NAME_P256: |
||
30 | return $nistFactory->curve256(); |
||
31 | case NistCurve::NAME_P384: |
||
32 | return $nistFactory->curve384(); |
||
33 | case NistCurve::NAME_P521: |
||
34 | return $nistFactory->curve521(); |
||
35 | case SecgCurve::NAME_SECP_112R1: |
||
36 | return $secpFactory->curve112r1(); |
||
37 | case SecgCurve::NAME_SECP_192K1: |
||
38 | return $secpFactory->curve192k1(); |
||
39 | case SecgCurve::NAME_SECP_256K1: |
||
40 | return $secpFactory->curve256k1(); |
||
41 | case SecgCurve::NAME_SECP_256R1: |
||
42 | return $secpFactory->curve256r1(); |
||
43 | case SecgCurve::NAME_SECP_384R1: |
||
44 | return $secpFactory->curve384r1(); |
||
45 | default: |
||
46 | $error = new UnsupportedCurveException('Unknown curve.'); |
||
47 | $error->setCurveName($name); |
||
48 | throw $error; |
||
49 | } |
||
108 |
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