cupoftea / chain

在对象上调用方法链

v1.2.1 2015-07-11 23:37 UTC

This package is auto-updated.

Last update: 2024-09-12 03:43:45 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version StyleCI License

在对象上调用方法链。

链提供了一种简单的方式来对对象上的方法链进行操作。

链提供了一套方法,以满足您的链式调用需求。从要求您的类是先前指定类的一个实例,到从每个调用的方法中获取结果,链式调用应有尽有。更多信息,请参阅文档或浏览完整的API。

快速入门

$ composer require cupoftea/chain ^1.2
$chain = new Chain();
$chain->requires(MyInterface::class)
    ->on(MyClass::class))
    ->call('method1', 'method2')
    ->with($parameter1, $parameter2)
    ->run();

$method1_result = $chain->getResult('method1');