| 1 | <?php |
||
| 23 | abstract class Agent |
||
| 24 | { |
||
| 25 | use AgentTrait; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Runs the Agent. |
||
| 29 | * |
||
| 30 | * Notice, that overriding agent's initialisation and body, should be done though `init` and `execute` methods, |
||
| 31 | * not here. |
||
| 32 | * |
||
| 33 | * @see Agent::init() |
||
| 34 | * @see Agent::execute() |
||
| 35 | */ |
||
| 36 | public function run() |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Initialization of the agent. |
||
| 45 | */ |
||
| 46 | protected function init() |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Agent execution. |
||
| 52 | * |
||
| 53 | * @return string Agent name if need again add his to queue. Use `$this->getAgentName()` for get name of agent. |
||
| 54 | */ |
||
| 55 | protected function execute() |
||
| 58 | } |
||
| 59 |