예제 #1
0
파일: Date.php 프로젝트: novuso/common-l
 /**
  * Constructs Date
  *
  * @internal
  *
  * @param int $year  The year
  * @param int $month The month
  * @param int $day   The day
  *
  * @throws DomainException When the date is not valid
  */
 private function __construct($year, $month, $day)
 {
     assert(Test::isInt($year), sprintf('%s expects $year to be an integer; received (%s) %s', __METHOD__, gettype($year), VarPrinter::toString($year)));
     assert(Test::isInt($month), sprintf('%s expects $month to be an integer; received (%s) %s', __METHOD__, gettype($month), VarPrinter::toString($month)));
     assert(Test::isInt($day), sprintf('%s expects $day to be an integer; received (%s) %s', __METHOD__, gettype($day), VarPrinter::toString($day)));
     $this->guardDate($year, $month, $day);
     $this->year = $year;
     $this->month = $month;
     $this->day = $day;
 }
예제 #2
0
 /**
  * Sets the version
  *
  * @param int $version The version
  *
  * @return void
  */
 public function setVersion($version)
 {
     assert(Test::isInt($version), 'Version must be an integer');
     $this->version = $version;
 }
예제 #3
0
파일: Money.php 프로젝트: novuso/common-l
 /**
  * Creates instance with a given amount using the same currency
  *
  * @param int $amount The amount
  *
  * @return Money
  */
 public function withAmount($amount)
 {
     assert(Test::isInt($amount), sprintf('%s expects $amount to be an integer; received (%s) %s', __METHOD__, gettype($amount), VarPrinter::toString($amount)));
     return new self($amount, $this->currency);
 }
예제 #4
0
파일: Time.php 프로젝트: novuso/common-l
 /**
  * Constructs Time
  *
  * @internal
  *
  * @param int $hour   The hour
  * @param int $minute The minute
  * @param int $second The second
  * @param int $micro  The microsecond
  *
  * @throws DomainException When the time is not valid
  */
 private function __construct($hour, $minute, $second, $micro)
 {
     assert(Test::isInt($hour), sprintf('%s expects $hour to be an integer; received (%s) %s', __METHOD__, gettype($hour), VarPrinter::toString($hour)));
     assert(Test::isInt($minute), sprintf('%s expects $minute to be an integer; received (%s) %s', __METHOD__, gettype($minute), VarPrinter::toString($minute)));
     assert(Test::isInt($second), sprintf('%s expects $second to be an integer; received (%s) %s', __METHOD__, gettype($second), VarPrinter::toString($second)));
     assert(Test::isInt($micro), sprintf('%s expects $micro to be an integer; received (%s) %s', __METHOD__, gettype($micro), VarPrinter::toString($micro)));
     $this->guardTime($hour, $minute, $second, $micro);
     $this->hour = $hour;
     $this->minute = $minute;
     $this->second = $second;
     $this->micro = $micro;
 }