Вход Регистрация
Файл: vendor/dragonmantank/cron-expression/src/Cron/MonthField.php
Строк: 36
<?php

declare(strict_types=1);

namespace 
Cron;

use 
DateTimeInterface;

/**
 * Month field.  Allows: * , / -.
 */
class MonthField extends AbstractField
{
    
/**
     * {@inheritdoc}
     */
    
protected $rangeStart 1;

    
/**
     * {@inheritdoc}
     */
    
protected $rangeEnd 12;

    
/**
     * {@inheritdoc}
     */
    
protected $literals = [=> 'JAN'=> 'FEB'=> 'MAR'=> 'APR'=> 'MAY'=> 'JUN'=> 'JUL',
        
=> 'AUG'=> 'SEP'10 => 'OCT'11 => 'NOV'12 => 'DEC', ];

    
/**
     * {@inheritdoc}
     */
    
public function isSatisfiedBy(DateTimeInterface $date$valuebool $invert): bool
    
{
        if (
$value === '?') {
            return 
true;
        }

        
$value $this->convertLiterals($value);

        return 
$this->isSatisfied((int) $date->format('m'), $value);
    }

    
/**
     * @inheritDoc
     *
     * @param DateTime|DateTimeImmutable $date
     */
    
public function increment(DateTimeInterface &$date$invert false$parts null): FieldInterface
    
{
        if (! 
$invert) {
            
$date $date->modify('first day of next month');
            
$date $date->setTime(00);
        } else {
            
$date $date->modify('last day of previous month');
            
$date $date->setTime(2359);
        }

        return 
$this;
    }
}
Онлайн: 0
Реклама