Conditions | 16 |
Paths | 12 |
Total Lines | 84 |
Code Lines | 58 |
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_DYNAMIC_GEOCENTRIC: |
||
77 | return new DynamicGeocentric( |
||
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_2D: |
||
84 | return new Geographic2D( |
||
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_DYNAMIC_GEOGRAPHIC_2D: |
||
91 | return new DynamicGeographic2D( |
||
92 | $epsgCode, |
||
93 | CoordinateSystem::fromEPSGCode($data['coord_sys_code']), |
||
94 | Datum::fromEPSGCode($data['datum_code']) |
||
95 | ); |
||
96 | |||
97 | case self::CRS_TYPE_GEOGRAPHIC_3D: |
||
98 | return new Geographic3D( |
||
99 | $epsgCode, |
||
100 | CoordinateSystem::fromEPSGCode($data['coord_sys_code']), |
||
101 | $data['datum_code'] ? Datum::fromEPSGCode($data['datum_code']) : self::fromEPSGCode($data['base_crs_code'])->getDatum() |
||
102 | ); |
||
103 | |||
104 | case self::CRS_TYPE_DYNAMIC_GEOGRAPHIC_3D: |
||
105 | return new DynamicGeographic3D( |
||
106 | $epsgCode, |
||
107 | CoordinateSystem::fromEPSGCode($data['coord_sys_code']), |
||
108 | Datum::fromEPSGCode($data['datum_code']) |
||
109 | ); |
||
110 | |||
111 | case self::CRS_TYPE_PROJECTED: |
||
112 | return new Projected( |
||
113 | $epsgCode, |
||
114 | CoordinateSystem::fromEPSGCode($data['coord_sys_code']), |
||
115 | self::fromEPSGCode($data['base_crs_code']) |
||
116 | ); |
||
117 | |||
118 | case self::CRS_TYPE_VERTICAL: |
||
119 | return new Vertical( |
||
120 | $epsgCode, |
||
121 | CoordinateSystem::fromEPSGCode($data['coord_sys_code']), |
||
122 | Datum::fromEPSGCode($data['datum_code']) |
||
123 | ); |
||
124 | |||
125 | case self::CRS_TYPE_DYNAMIC_VERTICAL: |
||
126 | return new DynamicVertical( |
||
127 | $epsgCode, |
||
128 | CoordinateSystem::fromEPSGCode($data['coord_sys_code']), |
||
129 | Datum::fromEPSGCode($data['datum_code']) |
||
130 | ); |
||
131 | |||
132 | case self::CRS_TYPE_COMPOUND: |
||
133 | return new Compound( |
||
134 | $epsgCode, |
||
135 | self::fromEPSGCode($data['cmpd_horizcrs_code']), |
||
136 | self::fromEPSGCode($data['cmpd_vertcrs_code']) |
||
137 | ); |
||
138 | |||
139 | default: |
||
140 | throw new UnknownCoordinateReferenceSystemException($epsgCode); |
||
141 | } |
||
159 |
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