jeyroik/extas-conditions

There is no license information available for the latest version (2.0.0) of this package.

Extas conditions package

2.0.0 2023-06-28 21:23 UTC

This package is auto-updated.

Last update: 2024-10-29 00:16:43 UTC


README

tests codecov.io Latest Stable Version Total Downloads Dependents

Описание

Условия и их проверка.

Использование

  1. Установить обработчики.

# vendor/bin/extas i

  1. Для использования проще всего реализовать интерфейс extas\interfaces\conditions\IHasConditions.
$hasCondition = new class ([
        IHasValue::FIELD__VALUE => [
            [
                'value' => 5,
                'condition' => '>'
            ],
            [
                'value' => 10,
                'condition' => '<'
            ]
        ],
        IHasCondition::FIELD__CONDITION => '&'
    ]) extends Item implements IHasCondition {
        use THasCondition;
        use THasValue;
        protected function getSubjectForExtension(): string
        {
            return '';
        }
    };

 echo $hasCondition->isConditionMet(7); // true
 echo $hasCondition->isConditionMet(5); // false