承接 devhelp/flow-control 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

devhelp/flow-control

Composer 安装命令:

composer require devhelp/flow-control

包简介

component that allows to control state changes in the flow.

关键字:

README 文档

README

Build Status SensioLabsInsight

Installation

Composer is preferred to install Flow Control, please check composer website for more information.

$ composer require 'devhelp/flow-control:dev-master'

Purpose

Flow Control is a simple tool that allows to control the flow defined in the Flow class.

Two main classes are Flow and FlowControl. Flow is defined using moves array and entry points. FlowControl is used to control state changes in flows.

Concept of the flow is general, some obvious use case can be, to define and control flow in checkout process

Usage

//two way flow with optional 'step_c'
$exampleFlowA = new Flow(
    'flow_a',
    array(
        'step_a' => array('step_b'),
        'step_b' => array('step_a', 'step_c', 'step_d'),
        'step_c' => array('step_b', 'step_d'),
        'step_d' => array('step_b', 'step_c')
    ),
    array('step_a')
);

//one way flow
$exampleFlowB = new Flow(
    'flow_b',
    array(
        'step_a' => array('step_b'),
        'step_b' => array('step_c'),
        'step_c' => array('step_d'),
    ),
    array('step_a')
);

$flows = array($exampleFlowA, $exampleFlowB);

$repository = new SimpleFlowRepository($flows);

$flowControl = new FlowControl($repository);

/**
 * origin of current steps is out of the scope of FlowControl component,
 * the same is regarding changing the state in the flow. FlowControl
 * is only for resolving valid moves
 */
$currentSteps = array(
    'flow_a' => 'step_c',
);

$flowControl->setFlowSteps($currentSteps);

$flowControl->isAllowed('step_d', 'flow_a'); //true
$flowControl->isAllowed('step_a', 'flow_a'); //false
$flowControl->isAllowed('step_c', 'flow_a'); //true
$flowControl->isAllowed('step_a', 'flow_b'); //true
$flowControl->isAllowed('step_b', 'flow_b'); //false

$moves = array(
    'flow_a' => 'step_d',
    'flow_b' => 'step_b',
);

$validMoves = $flowControl->resolveValid($moves); //array('flow_a' => 'step_d')

Credits

Brought to you by : Devhelp.pl (http://devhelp.pl)

统计信息

  • 总下载量: 97
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-05-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固