1 | <?php |
||
28 | abstract class BaseSymfonyWorker extends BaseWorker |
||
29 | { |
||
30 | /** |
||
31 | * Symfony event dispatcher. |
||
32 | * |
||
33 | * @var EventDispatcherInterface |
||
34 | */ |
||
35 | private $eventDispatcher; |
||
36 | |||
37 | 2 | public function __construct(ProcessorFactoryInterface $processorFactory, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger = null) |
|
38 | { |
||
39 | 2 | parent::__construct($processorFactory, $logger); |
|
40 | 2 | $this->eventDispatcher = $eventDispatcher; |
|
41 | 2 | } |
|
42 | |||
43 | /** |
||
44 | * Get subsystem name. |
||
45 | * |
||
46 | * This name may be used further to identify worker subsystem in logs or events. |
||
47 | * |
||
48 | * @return string |
||
49 | */ |
||
50 | abstract public function getSubsystemName(); |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | 2 | protected function beforeTranslateHook(&$commandData) |
|
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | 2 | protected function beforeGetProcessorHook(CommandInterface $command) |
|
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | 2 | protected function beforeProcessHook(CommandInterface $command, CommandProcessorInterface $processor) |
|
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | 1 | protected function afterProcessHook(CommandInterface $command, CommandProcessorInterface $processor) |
|
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | 1 | protected function processorErrorHook(CommandInterface $command, CommandProcessorInterface $processor, Exception $e) |
|
99 | |||
100 | /** |
||
101 | * Clear logs. |
||
102 | * |
||
103 | * @return void |
||
104 | */ |
||
105 | 2 | private function clearLogs() |
|
119 | |||
120 | } |
||
121 |