コード例 #1
0
 public function dateNowOf(Clock $clock)
 {
     return $this->dateFrom(LocalDate::nowOf($clock));
 }
コード例 #2
0
 /**
  * Obtains the current {@code ThaiBuddhistDate} from the specified clock.
  * <p>
  * This will query the specified clock to obtain the current date - today.
  * Using this method allows the use of an alternate clock for testing.
  * The alternate clock may be introduced using {@linkplain Clock dependency injection}.
  *
  * @param Clock $clock the clock to use, not null
  * @return ThaiBuddhistDate the current date, not null
  * @throws DateTimeException if the current date cannot be obtained
  */
 public static function nowOf(Clock $clock)
 {
     return new ThaiBuddhistDate(LocalDate::nowOf($clock));
 }
コード例 #3
0
ファイル: Year.php プロジェクト: celest-time/prototype
 /**
  * Obtains the current year from the specified clock.
  * <p>
  * This will query the specified clock to obtain the current year.
  * Using this method allows the use of an alternate clock for testing.
  * The alternate clock may be introduced using {@link Clock dependency injection}.
  *
  * @param Clock $clock the clock to use, not null
  * @return Year the current year, not null
  */
 public static function nowOf(Clock $clock)
 {
     $now = LocalDate::nowOf($clock);
     // called once
     return Year::of($now->getYear());
 }
コード例 #4
0
 /**
  * @expectedException \Celest\DateTimeException
  */
 public function test_now_Clock_tooLow()
 {
     $clock = Clock::fixed(self::MIN_INSTANT()->minusNanos(1), ZoneOffset::UTC());
     LocalDate::nowOf($clock);
 }
コード例 #5
0
ファイル: MonthDay.php プロジェクト: celest-time/prototype
 /**
  * Obtains the current month-day from the specified clock.
  * <p>
  * This will query the specified clock to obtain the current month-day.
  * Using this method allows the use of an alternate clock for testing.
  * The alternate clock may be introduced using {@link Clock dependency injection}.
  *
  * @param Clock $clock the clock to use, not null
  * @return MonthDay the current month-day, not null
  */
 public static function nowOf(Clock $clock)
 {
     $now = LocalDate::nowOf($clock);
     // called once
     return MonthDay::ofMonth($now->getMonth(), $now->getDayOfMonth());
 }
コード例 #6
0
ファイル: MinguoDate.php プロジェクト: celest-time/prototype
 /**
  * Obtains the current {@code MinguoDate} from the specified clock.
  * <p>
  * This will query the specified clock to obtain the current date - today.
  * Using this method allows the use of an alternate clock for testing.
  * The alternate clock may be introduced using {@linkplain Clock dependency injection}.
  *
  * @param Clock $clock the clock to use, not null
  * @return MinguoDate the current date, not null
  * @throws DateTimeException if the current date cannot be obtained
  */
 public static function nowOf(Clock $clock)
 {
     return new MinguoDate(LocalDate::nowOf($clock));
 }