| Conditions | 11 |
| Paths | 8 |
| Total Lines | 56 |
| Code Lines | 38 |
| 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 |
||
| 57 | public static function fromEPSGCode(int $epsgCode): self |
||
| 58 | { |
||
| 59 | $repository = static::$repository ?? new Repository(); |
||
| 60 | $allData = $repository->getCoordinateReferenceSystems(true); |
||
| 61 | |||
| 62 | if (!isset($allData[$epsgCode])) { |
||
| 63 | throw new UnknownCoordinateReferenceSystemException($epsgCode); |
||
| 64 | } |
||
| 65 | |||
| 66 | $data = $allData[$epsgCode]; |
||
| 67 | |||
| 68 | switch ($data['coord_ref_sys_kind']) { |
||
| 69 | case self::CRS_TYPE_GEOCENTRIC: |
||
| 70 | return new Geocentric( |
||
| 71 | $epsgCode, |
||
| 72 | CoordinateSystem::fromEPSGCode($data['coord_sys_code']), |
||
| 73 | $data['datum_code'] ? Datum::fromEPSGCode($data['datum_code']) : self::fromEPSGCode($data['base_crs_code'])->getDatum() |
||
| 74 | ); |
||
| 75 | |||
| 76 | case self::CRS_TYPE_GEOGRAPHIC_2D: |
||
| 77 | return new Geographic2D( |
||
| 78 | $epsgCode, |
||
| 79 | CoordinateSystem::fromEPSGCode($data['coord_sys_code']), |
||
| 80 | $data['datum_code'] ? Datum::fromEPSGCode($data['datum_code']) : self::fromEPSGCode($data['base_crs_code'])->getDatum() |
||
| 81 | ); |
||
| 82 | |||
| 83 | case self::CRS_TYPE_GEOGRAPHIC_3D: |
||
| 84 | return new Geographic3D( |
||
| 85 | $epsgCode, |
||
| 86 | CoordinateSystem::fromEPSGCode($data['coord_sys_code']), |
||
| 87 | $data['datum_code'] ? Datum::fromEPSGCode($data['datum_code']) : self::fromEPSGCode($data['base_crs_code'])->getDatum() |
||
| 88 | ); |
||
| 89 | |||
| 90 | case self::CRS_TYPE_PROJECTED: |
||
| 91 | return new Projected( |
||
| 92 | $epsgCode, |
||
| 93 | CoordinateSystem::fromEPSGCode($data['coord_sys_code']), |
||
| 94 | self::fromEPSGCode($data['base_crs_code']) |
||
| 95 | ); |
||
| 96 | |||
| 97 | case self::CRS_TYPE_VERTICAL: |
||
| 98 | return new Vertical( |
||
| 99 | $epsgCode, |
||
| 100 | CoordinateSystem::fromEPSGCode($data['coord_sys_code']), |
||
| 101 | Datum::fromEPSGCode($data['datum_code']) |
||
| 102 | ); |
||
| 103 | |||
| 104 | case self::CRS_TYPE_COMPOUND: |
||
| 105 | return new Compound( |
||
| 106 | $epsgCode, |
||
| 107 | self::fromEPSGCode($data['cmpd_horizcrs_code']), |
||
| 108 | self::fromEPSGCode($data['cmpd_vertcrs_code']) |
||
| 109 | ); |
||
| 110 | |||
| 111 | default: |
||
| 112 | throw new UnknownCoordinateReferenceSystemException($epsgCode); |
||
| 113 | } |
||
| 131 |
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