Conditions | 1 |
Paths | 1 |
Total Lines | 62 |
Code Lines | 44 |
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 |
||
72 | public function provideDataForDoubleTest() |
||
73 | { |
||
74 | return [ |
||
75 | 'positive double w/o plus sign and point' => [ |
||
76 | 'input' => 'd:1;', |
||
77 | 'expected' => 1.0, |
||
78 | ], |
||
79 | 'positive double w/ plus sign' => [ |
||
80 | 'input' => 'd:+1.5;', |
||
81 | 'expected' => 1.5, |
||
82 | ], |
||
83 | 'negative double' => [ |
||
84 | 'input' => 'd:-1.5;', |
||
85 | 'expected' => -1.5, |
||
86 | ], |
||
87 | 'positive double w/o dicimal part' => [ |
||
88 | 'input' => 'd:2.;', |
||
89 | 'expected' => 2.0, |
||
90 | ], |
||
91 | 'positive double w/o integer part and plus sign' => [ |
||
92 | 'input' => 'd:.5;', |
||
93 | 'expected' => 0.5, |
||
94 | ], |
||
95 | 'positive double w/o integer part w/ plus sign' => [ |
||
96 | 'input' => 'd:+.5;', |
||
97 | 'expected' => 0.5, |
||
98 | ], |
||
99 | 'negative double w/o integer part' => [ |
||
100 | 'input' => 'd:-.5;', |
||
101 | 'expected' => -0.5, |
||
102 | ], |
||
103 | 'positive double represented as exponential notion w/o plus sign' => [ |
||
104 | 'input' => 'd:1.0e10;', |
||
105 | 'expected' =>1e10, |
||
106 | ], |
||
107 | 'positive double represented as exponential notion w/ plus sign' => [ |
||
108 | 'input' => 'd:+1.0e10;', |
||
109 | 'expected' =>1e10, |
||
110 | ], |
||
111 | 'negative double represented as exponential notion' => [ |
||
112 | 'input' => 'd:-1.0e10;', |
||
113 | 'expected' => -1e10, |
||
114 | ], |
||
115 | |||
116 | 'positive double represented as exponential notion w/ positive exponential part' => [ |
||
117 | 'input' => 'd:25E+2;', |
||
118 | 'expected' => 2500.0, |
||
119 | ], |
||
120 | 'positive double represented as exponential notion w/ negative exponential part' => [ |
||
121 | 'input' => 'd:25E-2;', |
||
122 | 'expeced' => 0.25, |
||
123 | ], |
||
124 | 'positive infinity' => [ |
||
125 | 'input' => 'd:INF;', |
||
126 | 'expected' => INF, |
||
127 | ], |
||
128 | 'negative infinity' => [ |
||
129 | 'input' => 'd:-INF;', |
||
130 | 'expected' => -INF, |
||
131 | ], |
||
132 | ]; |
||
133 | } |
||
134 | |||
212 |