glebvvss / actionator
Library for making executable actions
Requires
- php: >=7.3
Requires (Dev)
- evert/phpdoc-md: ^0.2.0
- phpunit/phpunit: ^9.3
- victorjonsson/markdowndocs: ^1.3
README
Single atomic action (realizaton of "command" GoF pattern) for you own needs
Methods:
Action::execute() : self
Execute action and save result
Action::result($format = "") : mixed
Result of executed action. Can be prepared for client uses Format class name as first argument. Format class must implements Actionator\Format\FormatInterface for correct working.
Action::done(): bool
Returns true if action already executed
Actionator\Action
Base class for your own actions, which garantee that action will be executed once. For build your own actions you should extends this abstract class and implement code of your action in instionction abstract method
- This is an abstract class
- This class implements: Actionator\ActionInterface
Methods:
Action::instruction() : mixed
Source code of action, which can be executed. Returns result of operation if needed.
Action::execute() : self
See Actionator\ActionInterface
Action::result($format = "") : mixed
See Actionator\ActionInterface
Action::done(): bool
See Actionator\ActionInterface
Actionator\ComplexAction
Sometimes you want to use collection of actions like an single atomic action. Complex action is simple implementation for this.
- This class implements: Actionator\ActionInterface
Methods:
Action::__construct(array $actions)
Provide collection of actions, which will execute like single action
Action::execute() : self
See Actionator\ActionInterface
Action::result($format = "") : array
See Actionator\ActionInterface
Action::done(): bool
See Actionator\ActionInterface