jeyroik/extas-conditions

此包的最新版本(2.0.0)没有可用的许可证信息。

Extas 条件包

2.0.0 2023-06-28 21:23 UTC

This package is auto-updated.

Last update: 2024-09-29 00:03:32 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