| Code Coverage
| Classes and Traits | Functions and Methods | Lines
Total | 0.00% covered (danger) | 0.00% | 0 / 1 | 0.00% covered (danger) | 0.00% | 0 / 1 | CRAP | 66.67% covered (warning) | 66.67% | 4 / 6
Baseball | 0.00% covered (danger) | 0.00% | 0 / 1 | 0.00% covered (danger) | 0.00% | 0 / 1 | 2.15 | 66.67% covered (warning) | 66.67% | 4 / 6
calc_avg($ab,$hits) | 0.00% covered (danger) | 0.00% | 0 / 1 | 2.15 | 66.67% covered (warning) | 66.67% | 4 / 6

1 | <?php
2 | namespace stats;
3 |
4 | class Baseball
5 | {
6 | public function calc_avg($ab,$hits)
7 | {
8 | if ($ab == 0)
9 | {
10 | $avg = "0.000";
11 | }
12 | else
13 | {
14 | $avg = number_format($hits/$ab,3);
15 | }
16 | return $avg;
17 | }
18 | }
19 | ?>