cybersai/ussd-decision

使用对象类进行链式决策

v0.1.0 2020-03-14 15:34 UTC

This package is auto-updated.

Last update: 2024-09-04 23:58:36 UTC


README

Packagist Version Travis (.com) GitHub repo size GitHub

使用面向对象的决策回退进行决策

目前没有真正的文档,但您可以阅读测试

include 'vendor/autoload.php';

use Cybersai\UssdDecision\UssdDecision;

echo UssdDecision::using('0241122331') // Argument to use for decision making
    ->integer('It an integer') // Return this is the argument is an integer
    ->equal('0241122442', 'It my Number') // Return this is the argument is equal to the parameter given
    ->in(['05451111111', '05452222222'], 'It a schools line') // Return this is the argument is array provider
    ->length(6, 'Too short') // Return this is the argument length is 6
    ->phoneNumber('It a phone number') // Return this is the argument is a valid phone number
    ->any('Did not match any') // Just return this
    ->outcome(); // Give the outcome of the decision chain
// Output
It a phone number

安装

composer require cybersai/ussd-decision