コード例 #1
0
 /**
  * @dataProvider calendarMonthsCases
  */
 public function testCalculatesDiffInCalendarMonths(DI $date, DI $baseDate, $expectedCalendarMonths)
 {
     $request = new DateDiffRequest($date, $baseDate);
     $this->assertSame($expectedCalendarMonths, $request->getCalendarMonths());
 }
コード例 #2
0
ファイル: Results.php プロジェクト: wookieb/relative-date
 /**
  * Returns "months ago" result with absolute diff in calendar months
  * @param DateDiffRequest $request
  * @return DateDiffResult
  */
 public static function calculateMonthsAgo(DateDiffRequest $request)
 {
     return new DateDiffResult($request, self::MONTHS_AGO, abs($request->getCalendarMonths()));
 }
コード例 #3
0
 public function isApplicable(DateDiffRequest $diffRequest)
 {
     return $diffRequest->getCalendarMonths() < 0;
 }