for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace morphos\English;
use InvalidArgumentException;
class TimeSpeller extends \morphos\TimeSpeller
{
protected static $units = [
self::YEAR => 'year',
self::MONTH => 'month',
self::DAY => 'day',
self::HOUR => 'hour',
self::MINUTE => 'minute',
self::SECOND => 'second',
];
public static function spellUnit($count, $unit)
if (!isset(self::$units[$unit])) {
throw new InvalidArgumentException('Unknown time unit: '.$unit);
}
return $count.' '.NounPluralization::pluralize(self::$units[$unit], $count);