| Conditions | 5 |
| Paths | 4 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | 19 | public static function spellUnit($count, $unit) |
|
| 35 | { |
||
| 36 | 19 | if (!isset(static::$units[$unit])) { |
|
| 37 | 1 | throw new InvalidArgumentException('Unknown time unit: '.$unit); |
|
| 38 | } |
||
| 39 | |||
| 40 | 18 | if ($count === 1 && in_array($unit, [self::SECOND, self::MINUTE], true)) { |
|
| 41 | 1 | if ($unit === self::SECOND) |
|
| 42 | 1 | return '1 секунду'; |
|
| 43 | 1 | return '1 минуту'; |
|
| 44 | } |
||
| 45 | |||
| 46 | 17 | return pluralize($count, static::$units[$unit]); |
|
| 47 | } |
||
| 48 | } |
||
| 49 |