public function speak($format = '%F %T') { $format = str_replace('%v', '{%w}', $format); $result = strftime($format, $this->getTimestamp()); if (strpos($format, '{%w}') !== false) { static $weekdays = ['0' => '日', '1' => '一', '2' => '二', '3' => '三', '4' => '四', '5' => '五', '6' => '六']; $result = Word::replaceWith($result, $weekdays, '{', '}'); } return $result; }
public static function format($message, array $context = []) { $content = is_null($message) ? '' : (string) $message; return Word::replaceWith($content, $context, '{', '}'); }