Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aurimasniekis/action_blocks_concept

Action blocks proof of concept
https://github.com/aurimasniekis/action_blocks_concept

Last synced: 1 day ago
JSON representation

Action blocks proof of concept

Awesome Lists containing this project

README

        

Action blocks proof of concept
=============================

Code:
-----

```php
addExecutor($addExecutor);
$executor->addExecutor($multiplyExecutor);
$executor->addExecutor($inSequelExecutor);

$actions = new \Acme\Action\InSequelAction(
new \Acme\Action\AddAction(
new \Acme\Action\AddAction(2, 2),
new \Acme\Action\MultiplyAction(2, new \Acme\Action\AddAction(2, 2))
),
new \Acme\Action\AddAction(
new \Acme\Action\AddAction(3, 3),
new \Acme\Action\MultiplyAction(3, new \Acme\Action\AddAction(3, 3))
),
new \Acme\Action\AddAction(
new \Acme\Action\AddAction(4, 4),
new \Acme\Action\MultiplyAction(4, new \Acme\Action\AddAction(4, 4))
)
);

var_dump($executor->execute($actions));
```

Result
------

```php
array(3) {
[0] =>
int(12)
[1] =>
int(24)
[2] =>
int(40)
}
```