Conditions | 2 |
Paths | 2 |
Total Lines | 86 |
Code Lines | 71 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
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 |
||
35 | public function validInputProvider() { |
||
36 | $argLists = []; |
||
37 | |||
38 | $valid = [ |
||
39 | // Whitespace |
||
40 | "1N 1E\n" => [ 1, 1, 1 ], |
||
41 | ' 1N 1E ' => [ 1, 1, 1 ], |
||
42 | |||
43 | // Float |
||
44 | '55.7557860 N, 37.6176330 W' => [ 55.7557860, -37.6176330, 0.000001 ], |
||
45 | '55.7557860N,37.6176330W' => [ 55.7557860, -37.6176330, 0.000001 ], |
||
46 | '55.7557860, -37.6176330' => [ 55.7557860, -37.6176330, 0.000001 ], |
||
47 | '55.7557860, -37.6176330 ' => [ 55.7557860, -37.6176330, 0.000001 ], |
||
48 | '55 S, 37.6176330 W' => [ -55, -37.6176330, 0.000001 ], |
||
49 | '55 S,37.6176330W' => [ -55, -37.6176330, 0.000001 ], |
||
50 | '-55, -37.6176330' => [ -55, -37.6176330, 0.000001 ], |
||
51 | '5.5S,37W ' => [ -5.5, -37, 0.1 ], |
||
52 | '-5.5,-37 ' => [ -5.5, -37, 0.1 ], |
||
53 | '-5.5 -37 ' => [ -5.5, -37, 0.1 ], |
||
54 | '4,2' => [ 4, 2, 1 ], |
||
55 | '5.5S 37W ' => [ -5.5, -37, 0.1 ], |
||
56 | '5.5 S 37 W ' => [ -5.5, -37, 0.1 ], |
||
57 | '4 2' => [ 4, 2, 1 ], |
||
58 | 'S5.5 W37 ' => [ -5.5, -37, 0.1 ], |
||
59 | |||
60 | // DD |
||
61 | '55.7557860° N, 37.6176330° W' => [ 55.7557860, -37.6176330, 0.000001 ], |
||
62 | '55.7557860°, -37.6176330°' => [ 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°, -37.6176330 °' => [ -55, -37.6176330, 0.000001 ], |
||
67 | '5.5°S,37°W ' => [ -5.5, -37, 0.1 ], |
||
68 | '5.5° S,37° W ' => [ -5.5, -37, 0.1 ], |
||
69 | '-5.5°,-37° ' => [ -5.5, -37, 0.1 ], |
||
70 | '-55° -37.6176330 °' => [ -55, -37.6176330, 0.000001 ], |
||
71 | '5.5°S 37°W ' => [ -5.5, -37, 0.1 ], |
||
72 | '-5.5 ° -37 ° ' => [ -5.5, -37, 0.1 ], |
||
73 | 'S5.5° W37°' => [ -5.5, -37, 0.1 ], |
||
74 | ' S 5.5° W 37°' => [ -5.5, -37, 0.1 ], |
||
75 | |||
76 | // DMS |
||
77 | '55° 45\' 20.8296", 37° 37\' 3.4788"' => [ 55.755786, 37.617633, 0.0001 / 3600 ], |
||
78 | '55° 45\' 20.8296", -37° 37\' 3.4788"' => [ 55.755786, -37.617633, 0.0001 / 3600 ], |
||
79 | '-55° 45\' 20.8296", -37° 37\' 3.4788"' => [ -55.755786, -37.617633, 0.0001 / 3600 ], |
||
80 | '-55° 45\' 20.8296", 37° 37\' 3.4788"' => [ -55.755786, 37.617633, 0.0001 / 3600 ], |
||
81 | '-55° 45\' 20.8296", 37° 37\' 3.4788" ' => [ -55.755786, 37.617633, 0.0001 / 3600 ], |
||
82 | '55° 0\' 0", 37° 0\' 0"' => [ 55, 37, 1 / 3600 ], |
||
83 | '55° 30\' 0", 37° 30\' 0"' => [ 55.5, 37.5, 1 / 3600 ], |
||
84 | '55° 0\' 18", 37° 0\' 18"' => [ 55.005, 37.005, 1 / 3600 ], |
||
85 | ' 55° 0\' 18", 37° 0\' 18"' => [ 55.005, 37.005, 1 / 3600 ], |
||
86 | '0° 0\' 0", 0° 0\' 0"' => [ 0, 0, 1 / 3600 ], |
||
87 | '0° 0\' 18" N, 0° 0\' 18" E' => [ 0.005, 0.005, 1 / 3600 ], |
||
88 | ' 0° 0\' 18" S , 0° 0\' 18" W ' => [ -0.005, -0.005, 1 / 3600 ], |
||
89 | '0° 0′ 18″ N, 0° 0′ 18″ E' => [ 0.005, 0.005, 1 / 3600 ], |
||
90 | '0° 0\' 18" N 0° 0\' 18" E' => [ 0.005, 0.005, 1 / 3600 ], |
||
91 | ' 0 ° 0 \' 18 " S 0 ° 0 \' 18 " W ' => [ -0.005, -0.005, 1 / 3600 ], |
||
92 | '0° 0′ 18″ N 0° 0′ 18″ E' => [ 0.005, 0.005, 1 / 3600 ], |
||
93 | 'N 0° 0\' 18" E 0° 0\' 18"' => [ 0.005, 0.005, 1 / 3600 ], |
||
94 | 'N0°0\'18"E0°0\'18"' => [ 0.005, 0.005, 1 / 3600 ], |
||
95 | 'N0°0\'18" E0°0\'18"' => [ 0.005, 0.005, 1 / 3600 ], |
||
96 | |||
97 | // DM |
||
98 | '55° 0\', 37° 0\'' => [ 55, 37, 1 / 60 ], |
||
99 | '55° 30\', 37° 30\'' => [ 55.5, 37.5, 1 / 60 ], |
||
100 | '0° 0\', 0° 0\'' => [ 0, 0, 1 / 60 ], |
||
101 | ' 0° 0\', 0° 0\'' => [ 0, 0, 1 / 60 ], |
||
102 | ' 0° 0\', 0° 0\' ' => [ 0, 0, 1 / 60 ], |
||
103 | '-55° 30\', -37° 30\'' => [ -55.5, -37.5, 1 / 60 ], |
||
104 | '0° 0.3\' S, 0° 0.3\' W' => [ -0.005, -0.005, 1 / 3600 ], |
||
105 | '-55° 30′, -37° 30′' => [ -55.5, -37.5, 1 / 60 ], |
||
106 | '-55 ° 30 \' -37 ° 30 \'' => [ -55.5, -37.5, 1 / 60 ], |
||
107 | '0° 0.3\' S 0° 0.3\' W' => [ -0.005, -0.005, 1 / 3600 ], |
||
108 | '-55° 30′ -37° 30′' => [ -55.5, -37.5, 1 / 60 ], |
||
109 | 'S 0° 0.3\' W 0° 0.3\'' => [ -0.005, -0.005, 1 / 3600 ], |
||
110 | 'S0°0.3\'W0°0.3\'' => [ -0.005, -0.005, 1 / 3600 ], |
||
111 | 'S0°0.3\' W0°0.3\'' => [ -0.005, -0.005, 1 / 3600 ], |
||
112 | ]; |
||
113 | |||
114 | foreach ( $valid as $value => $expected ) { |
||
115 | $expected = new GlobeCoordinateValue( new LatLongValue( $expected[0], $expected[1] ), $expected[2] ); |
||
116 | $argLists[] = [ (string)$value, $expected ]; |
||
117 | } |
||
118 | |||
119 | return $argLists; |
||
120 | } |
||
121 | |||
269 |