diff --git a/src/Calculators/AnnuityCalculator.php b/src/Calculators/AnnuityCalculator.php index 72f549c..b9e701b 100644 --- a/src/Calculators/AnnuityCalculator.php +++ b/src/Calculators/AnnuityCalculator.php @@ -128,21 +128,21 @@ public function getAnnuityNoOfCompoundingPeriods() { * @return string */ public function getAnnuityPeriodLengthInYears() { - return $this->annuityPeriodLength->asYears(); + return $this->annuityPeriodLength->toYears(); } /** * @return string */ public function getAnnuityPeriodLengthInMonths() { - return $this->annuityPeriodLength->asMonths(); + return $this->annuityPeriodLength->toMonths(); } /** * @return mixed */ public function getAnnuityPeriodLengthInDays() { - return $this->annuityPeriodLength->asDays(); + return $this->annuityPeriodLength->toDays(); } /** diff --git a/src/Utils/Time/TimeSpan.php b/src/Utils/Time/TimeSpan.php index 63772a6..1852e8a 100644 --- a/src/Utils/Time/TimeSpan.php +++ b/src/Utils/Time/TimeSpan.php @@ -154,7 +154,7 @@ public function getDaysComponent() { * @return string * @throws Exception */ - public function asYears() { + public function toYears() { $monthsComponent = MathFuncs::div( $this->getMonthsComponent(), 12 @@ -173,7 +173,7 @@ public function asYears() { * @return string * @throws Exception */ - public function asMonths() { + public function toMonths() { $yearsComponent = MathFuncs::mul($this->getYearsComponent(), 12); $daysComponent = TimeUtils::getCurrentDayCountConvention()['days_in_a_month'] == 0 ? 0 : @@ -189,7 +189,7 @@ public function asMonths() { * @return string * @throws Exception */ - public function asDays() { + public function toDays() { $yearsComponent = MathFuncs::mul( $this->getYearsComponent(), TimeUtils::getCurrentDayCountConvention()['days_in_a_year'] @@ -278,7 +278,7 @@ private function roundDateInterval(DateInterval $dateInterval) { * @return string */ public function __toString() { - return $this->asDays(); + return $this->toDays(); } } } \ No newline at end of file diff --git a/tests/TimeUtilsTest.php b/tests/TimeUtilsTest.php index 392c969..f75e5cd 100644 --- a/tests/TimeUtilsTest.php +++ b/tests/TimeUtilsTest.php @@ -15,15 +15,15 @@ class TimeUtilsTest extends PHPUnit_Framework_TestCase { private $DAYS = 360; public function testYearsFromTimeSpan() { - $this->assertEquals(1.75, $this->timeSpan->asYears()); + $this->assertEquals(1.75, $this->timeSpan->toYears()); } public function testMonthsFromTimeSpan() { - $this->assertEquals(21, $this->timeSpan->asMonths()); + $this->assertEquals(21, $this->timeSpan->toMonths()); } public function testDaysFromTimeSpan() { - $this->assertEquals(630, $this->timeSpan->asDays()); + $this->assertEquals(630, $this->timeSpan->toDays()); } public function testGetYearsFromDays() {