/** * Get the difference formatter instance or overwrite the current one. * * @param \Cake\I18n\RelativeTimeFormatter|null $formatter The formatter instance when setting. * @return \Cake\I18n\RelativeTimeFormatter The formatter instance. */ public static function diffFormatter($formatter = null) { if ($formatter === null) { // Use the static property defined in chronos. if (static::$diffFormatter === null) { static::$diffFormatter = new RelativeTimeFormatter(); } return static::$diffFormatter; } return static::$diffFormatter = $translator; }
/** * Get the difference formatter instance or overwrite the current one. * * @param \Cake\Chronos\DifferenceFormatter|null $formatter The formatter instance when setting. * @return \Cake\Chronos\DifferenceFormatter The formatter instance. */ public static function diffFormatter($formatter = null) { if ($formatter === null) { if (static::$diffFormatter === null) { static::$diffFormatter = new DifferenceFormatter(); } return static::$diffFormatter; } return static::$diffFormatter = $translator; }