| 1 | <?php |
||
| 9 | abstract class AbstractApi implements IAhgoraApi |
||
| 10 | { |
||
| 11 | use Loggable; |
||
| 12 | |||
| 13 | /** @var string */ |
||
| 14 | protected $datetimeFormat = 'Y-m-d H:i:s'; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Validate if the given month is valid. |
||
| 18 | * |
||
| 19 | * @param int $month |
||
| 20 | * |
||
| 21 | * @return bool |
||
| 22 | */ |
||
| 23 | protected function isValidMonth($month) |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Validate if the given year is "valid". |
||
| 30 | * |
||
| 31 | * @param int $year |
||
| 32 | * |
||
| 33 | * @return bool |
||
| 34 | */ |
||
| 35 | protected function isValidYear($year) |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Validate if the given period is valid. |
||
| 42 | * |
||
| 43 | * @param int $month |
||
| 44 | * @param int $year |
||
| 45 | * |
||
| 46 | * @return bool |
||
| 47 | */ |
||
| 48 | protected function isValidPeriod($month, $year) |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Check if the given time period is in the future. |
||
| 55 | * |
||
| 56 | * @param int $month |
||
| 57 | * @param int $year |
||
| 58 | * |
||
| 59 | * @return bool |
||
| 60 | */ |
||
| 61 | private function isFutureDate($month, $year) |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Set the Datetime parse format. Default 'Y-m-d H:i:s'. |
||
| 70 | * |
||
| 71 | * @param $format |
||
| 72 | * |
||
| 73 | * @return $this |
||
| 74 | */ |
||
| 75 | public function setDateTimeFormat($format) |
||
| 81 | } |
||
| 82 |