<?php
/*
* This file is part of Chevere.
*
* (c) Rodolfo Berrios <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
use function Chevere\Workflow\{response,run,sync,variable,workflow};
require 'loader.php';
/*
* php demo/chevere.php
*/
use Chevere\Action\Action;
class MyAction extends Action
{
protected function main(string $foo): string
{
return "Hello, {$foo}";
}
}
$workflow = workflow(
greet: sync(
new MyAction(),
foo: variable('super'),
),
capo: sync(
new MyAction(),
foo: response('greet'),
),
);
$hello = run(
$workflow,
super: 'Chevere',
);
echo $hello->response('greet')->string() . PHP_EOL;
// Hello, Chevere
echo $hello->response('capo')->string() . PHP_EOL;
// Hello, Hello, Chevere
|