ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Helpers.php
Go to the documentation of this file.
1 <?php
2 
4 
9 
10 class Helpers
11 {
27  public static function daysPerYear($year, $basis = 0)
28  {
29  if (!is_numeric($basis)) {
30  return Functions::NAN();
31  }
32 
33  switch ($basis) {
34  case FinancialConstants::BASIS_DAYS_PER_YEAR_NASD:
35  case FinancialConstants::BASIS_DAYS_PER_YEAR_360:
36  case FinancialConstants::BASIS_DAYS_PER_YEAR_360_EUROPEAN:
37  return 360;
38  case FinancialConstants::BASIS_DAYS_PER_YEAR_365:
39  return 365;
40  case FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL:
41  return (DateTimeExcel\Helpers::isLeapYear($year)) ? 366 : 365;
42  }
43 
44  return Functions::NAN();
45  }
46 
54  public static function isLastDayOfMonth(DateTimeInterface $date): bool
55  {
56  return $date->format('d') === $date->format('t');
57  }
58 }
static isLastDayOfMonth(DateTimeInterface $date)
isLastDayOfMonth.
Definition: Helpers.php:54
static isLeapYear($year)
Identify if a year is a leap year or not.
Definition: Helpers.php:19
static daysPerYear($year, $basis=0)
daysPerYear.
Definition: Helpers.php:27