| Conditions | 4 |
| Paths | 2 |
| Total Lines | 9 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public static function calculate_progress_value( $raised, $target ) { |
||
| 30 | $raised = \floatval( $raised ); |
||
| 31 | $target = \floatval( $target ); |
||
| 32 | |||
| 33 | if ( 0 == $target && ( 0 == $raised || $raised > $target ) ) { |
||
| 34 | $target = 100; |
||
| 35 | } |
||
| 36 | |||
| 37 | return (int) floor( ( $raised / $target ) * 100 ); |
||
| 38 | } |
||
| 40 |