# notifier/2.7.13/libraries/action-scheduler/lib/cron-expression/CronExpression_YearField.php

WANotifier for Forms and Actions, version 2.7.13. 44 lines.

- Page: https://pluginprobe.com/plugins/notifier/2.7.13/code/libraries/action-scheduler/lib/cron-expression/CronExpression_YearField.php
- Raw: https://pluginprobe.com/plugins/notifier/2.7.13/raw/libraries/action-scheduler/lib/cron-expression/CronExpression_YearField.php
- Modified: 2026-02-06T12:53:28+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/notifier/2.7.13/code/libraries/action-scheduler/lib/cron-expression/CronExpression_YearField.php#L10-L20`.

```php
<?php

/**
 * Year field.  Allows: * , / -
 *
 * @author Michael Dowling <mtdowling@gmail.com>
 */
class CronExpression_YearField extends CronExpression_AbstractField
{
    /**
     * {@inheritdoc}
     */
    public function isSatisfiedBy(DateTime $date, $value)
    {
        return $this->isSatisfied($date->format('Y'), $value);
    }

    /**
     * {@inheritdoc}
     */
    public function increment(DateTime $date, $invert = false)
    {
        if ($invert) {
            $date->modify('-1 year');
            $date->setDate($date->format('Y'), 12, 31);
            $date->setTime(23, 59, 0);
        } else {
            $date->modify('+1 year');
            $date->setDate($date->format('Y'), 1, 1);
            $date->setTime(0, 0, 0);
        }

        return $this;
    }

    /**
     * {@inheritdoc}
     */
    public function validate($value)
    {
        return (bool) preg_match('/[\*,\/\-0-9]+/', $value);
    }
}

```
