[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 declare(strict_types=1); 4 5 namespace Cron; 6 7 use DateTimeInterface; 8 9 /** 10 * Month field. Allows: * , / -. 11 */ 12 class MonthField extends AbstractField 13 { 14 /** 15 * {@inheritdoc} 16 */ 17 protected $rangeStart = 1; 18 19 /** 20 * {@inheritdoc} 21 */ 22 protected $rangeEnd = 12; 23 24 /** 25 * {@inheritdoc} 26 */ 27 protected $literals = [1 => 'JAN', 2 => 'FEB', 3 => 'MAR', 4 => 'APR', 5 => 'MAY', 6 => 'JUN', 7 => 'JUL', 28 8 => 'AUG', 9 => 'SEP', 10 => 'OCT', 11 => 'NOV', 12 => 'DEC', ]; 29 30 /** 31 * {@inheritdoc} 32 */ 33 public function isSatisfiedBy(DateTimeInterface $date, $value, bool $invert): bool 34 { 35 if ($value === '?') { 36 return true; 37 } 38 39 $value = $this->convertLiterals($value); 40 41 return $this->isSatisfied((int) $date->format('m'), $value); 42 } 43 44 /** 45 * @inheritDoc 46 * 47 * @param \DateTime|\DateTimeImmutable $date 48 */ 49 public function increment(DateTimeInterface &$date, $invert = false, $parts = null): FieldInterface 50 { 51 if (! $invert) { 52 $date = $date->modify('first day of next month'); 53 $date = $date->setTime(0, 0); 54 } else { 55 $date = $date->modify('last day of previous month'); 56 $date = $date->setTime(23, 59); 57 } 58 59 return $this; 60 } 61 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |