Conditions | 2 |
Paths | 2 |
Total Lines | 86 |
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 |
||
52 | public function validInputProvider() { |
||
53 | $argLists = []; |
||
54 | |||
55 | $valid = [ |
||
56 | // Whitespace |
||
57 | "1N 1E\n" => [ 1, 1, 1 ], |
||
58 | ' 1N 1E ' => [ 1, 1, 1 ], |
||
59 | |||
60 | // Float |
||
61 | '55.7557860 N, 37.6176330 W' => [ 55.7557860, -37.6176330, 0.000001 ], |
||
62 | '55.7557860N,37.6176330W' => [ 55.7557860, -37.6176330, 0.000001 ], |
||
63 | '55.7557860, -37.6176330' => [ 55.7557860, -37.6176330, 0.000001 ], |
||
64 | '55.7557860, -37.6176330 ' => [ 55.7557860, -37.6176330, 0.000001 ], |
||
65 | '55 S, 37.6176330 W' => [ -55, -37.6176330, 0.000001 ], |
||
66 | '55 S,37.6176330W' => [ -55, -37.6176330, 0.000001 ], |
||
67 | '-55, -37.6176330' => [ -55, -37.6176330, 0.000001 ], |
||
68 | '5.5S,37W ' => [ -5.5, -37, 0.1 ], |
||
69 | '-5.5,-37 ' => [ -5.5, -37, 0.1 ], |
||
70 | '-5.5 -37 ' => [ -5.5, -37, 0.1 ], |
||
71 | '4,2' => [ 4, 2, 1 ], |
||
72 | '5.5S 37W ' => [ -5.5, -37, 0.1 ], |
||
73 | '5.5 S 37 W ' => [ -5.5, -37, 0.1 ], |
||
74 | '4 2' => [ 4, 2, 1 ], |
||
75 | 'S5.5 W37 ' => [ -5.5, -37, 0.1 ], |
||
76 | |||
77 | // DD |
||
78 | '55.7557860° N, 37.6176330° W' => [ 55.7557860, -37.6176330, 0.000001 ], |
||
79 | '55.7557860°, -37.6176330°' => [ 55.7557860, -37.6176330, 0.000001 ], |
||
80 | '55.7557860°,-37.6176330°' => [ 55.7557860, -37.6176330, 0.000001 ], |
||
81 | '55.7557860°,-37.6176330° ' => [ 55.7557860, -37.6176330, 0.000001 ], |
||
82 | '55° S, 37.6176330 ° W' => [ -55, -37.6176330, 0.000001 ], |
||
83 | '-55°, -37.6176330 °' => [ -55, -37.6176330, 0.000001 ], |
||
84 | '5.5°S,37°W ' => [ -5.5, -37, 0.1 ], |
||
85 | '5.5° S,37° W ' => [ -5.5, -37, 0.1 ], |
||
86 | '-5.5°,-37° ' => [ -5.5, -37, 0.1 ], |
||
87 | '-55° -37.6176330 °' => [ -55, -37.6176330, 0.000001 ], |
||
88 | '5.5°S 37°W ' => [ -5.5, -37, 0.1 ], |
||
89 | '-5.5 ° -37 ° ' => [ -5.5, -37, 0.1 ], |
||
90 | 'S5.5° W37°' => [ -5.5, -37, 0.1 ], |
||
91 | ' S 5.5° W 37°' => [ -5.5, -37, 0.1 ], |
||
92 | |||
93 | // DMS |
||
94 | '55° 45\' 20.8296", 37° 37\' 3.4788"' => [ 55.755786, 37.617633, 0.0001 / 3600 ], |
||
95 | '55° 45\' 20.8296", -37° 37\' 3.4788"' => [ 55.755786, -37.617633, 0.0001 / 3600 ], |
||
96 | '-55° 45\' 20.8296", -37° 37\' 3.4788"' => [ -55.755786, -37.617633, 0.0001 / 3600 ], |
||
97 | '-55° 45\' 20.8296", 37° 37\' 3.4788"' => [ -55.755786, 37.617633, 0.0001 / 3600 ], |
||
98 | '-55° 45\' 20.8296", 37° 37\' 3.4788" ' => [ -55.755786, 37.617633, 0.0001 / 3600 ], |
||
99 | '55° 0\' 0", 37° 0\' 0"' => [ 55, 37, 1 / 3600 ], |
||
100 | '55° 30\' 0", 37° 30\' 0"' => [ 55.5, 37.5, 1 / 3600 ], |
||
101 | '55° 0\' 18", 37° 0\' 18"' => [ 55.005, 37.005, 1 / 3600 ], |
||
102 | ' 55° 0\' 18", 37° 0\' 18"' => [ 55.005, 37.005, 1 / 3600 ], |
||
103 | '0° 0\' 0", 0° 0\' 0"' => [ 0, 0, 1 / 3600 ], |
||
104 | '0° 0\' 18" N, 0° 0\' 18" E' => [ 0.005, 0.005, 1 / 3600 ], |
||
105 | ' 0° 0\' 18" S , 0° 0\' 18" W ' => [ -0.005, -0.005, 1 / 3600 ], |
||
106 | '0° 0′ 18″ N, 0° 0′ 18″ E' => [ 0.005, 0.005, 1 / 3600 ], |
||
107 | '0° 0\' 18" N 0° 0\' 18" E' => [ 0.005, 0.005, 1 / 3600 ], |
||
108 | ' 0 ° 0 \' 18 " S 0 ° 0 \' 18 " W ' => [ -0.005, -0.005, 1 / 3600 ], |
||
109 | '0° 0′ 18″ N 0° 0′ 18″ E' => [ 0.005, 0.005, 1 / 3600 ], |
||
110 | 'N 0° 0\' 18" E 0° 0\' 18"' => [ 0.005, 0.005, 1 / 3600 ], |
||
111 | 'N0°0\'18"E0°0\'18"' => [ 0.005, 0.005, 1 / 3600 ], |
||
112 | 'N0°0\'18" E0°0\'18"' => [ 0.005, 0.005, 1 / 3600 ], |
||
113 | |||
114 | // DM |
||
115 | '55° 0\', 37° 0\'' => [ 55, 37, 1 / 60 ], |
||
116 | '55° 30\', 37° 30\'' => [ 55.5, 37.5, 1 / 60 ], |
||
117 | '0° 0\', 0° 0\'' => [ 0, 0, 1 / 60 ], |
||
118 | ' 0° 0\', 0° 0\'' => [ 0, 0, 1 / 60 ], |
||
119 | ' 0° 0\', 0° 0\' ' => [ 0, 0, 1 / 60 ], |
||
120 | '-55° 30\', -37° 30\'' => [ -55.5, -37.5, 1 / 60 ], |
||
121 | '0° 0.3\' S, 0° 0.3\' W' => [ -0.005, -0.005, 1 / 3600 ], |
||
122 | '-55° 30′, -37° 30′' => [ -55.5, -37.5, 1 / 60 ], |
||
123 | '-55 ° 30 \' -37 ° 30 \'' => [ -55.5, -37.5, 1 / 60 ], |
||
124 | '0° 0.3\' S 0° 0.3\' W' => [ -0.005, -0.005, 1 / 3600 ], |
||
125 | '-55° 30′ -37° 30′' => [ -55.5, -37.5, 1 / 60 ], |
||
126 | 'S 0° 0.3\' W 0° 0.3\'' => [ -0.005, -0.005, 1 / 3600 ], |
||
127 | 'S0°0.3\'W0°0.3\'' => [ -0.005, -0.005, 1 / 3600 ], |
||
128 | 'S0°0.3\' W0°0.3\'' => [ -0.005, -0.005, 1 / 3600 ], |
||
129 | ]; |
||
130 | |||
131 | foreach ( $valid as $value => $expected ) { |
||
132 | $expected = new GlobeCoordinateValue( new LatLongValue( $expected[0], $expected[1] ), $expected[2] ); |
||
133 | $argLists[] = [ (string)$value, $expected ]; |
||
134 | } |
||
135 | |||
136 | return $argLists; |
||
137 | } |
||
138 | |||
260 |