예제 #1
0
 /**
  * @param $annuityPeriodLength
  */
 public function setAnnuityPeriodLength(TimeSpan $annuityPeriodLength)
 {
     if (Helpers::checkIfNotNegativeNumberOrThrowAnException((string) $annuityPeriodLength)) {
         if (Helpers::checkIfZero($this->annuityNoOfCompoundingPeriods)) {
             $annuityPeriodLength = TimeSpan::asDuration(0);
         }
         $this->setProperty("annuityPeriodLength", $annuityPeriodLength);
     }
 }
예제 #2
0
 /**
  * @param integer $years
  * @param integer $months
  * @param integer $days
  * @return TimeSpan
  */
 public static function asDuration($years, $months = 0, $days = 0)
 {
     foreach (func_get_args() as $arg) {
         Helpers::checkIfNotNegativeNumberOrThrowAnException($arg);
     }
     $newThis = new TimeSpan();
     $newThis->newDateIntervalAbsolute($years, $months, $days);
     return $newThis;
 }
예제 #3
0
 public function testCheckIfNotNegativeNumberException()
 {
     $this->setExpectedException('InvalidArgumentException', ErrorMessages::getMustNotBeNegativeNumberMessage("-6"));
     Helpers::checkIfNotNegativeNumberOrThrowAnException(-6);
 }