Your IP : 216.73.216.229


Current Path : /home/jeromecohp/www/administrator/components/com_conditions/src/Condition/Date/
Upload File :
Current File : /home/jeromecohp/www/administrator/components/com_conditions/src/Condition/Date/Month.php

<?php
/**
 * @package         Conditions
 * @version         25.1.10755
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            https://regularlabs.com
 * @copyright       Copyright © 2025 Regular Labs All Rights Reserved
 * @license         GNU General Public License version 2 or later
 */

namespace RegularLabs\Component\Conditions\Administrator\Condition\Date;

defined('_JEXEC') or die;

use RegularLabs\Component\Conditions\Administrator\Condition\Condition;
use RegularLabs\Component\Conditions\Administrator\Condition\HasArraySelection;
use RegularLabs\Component\Conditions\Administrator\Helper\Date as DateHelper;

class Month extends Condition
{
    use HasArraySelection;

    public function pass(): bool
    {
        $current_month = DateHelper::getString('', 'm'); // 01 (for January) through 12 (for December)

        foreach ($this->selection as &$month)
        {
            $month = DateHelper::getMonthNumber($month);
        }

        return $this->passSimple((int) $current_month);
    }
}