1 | <?php |
||
21 | trait ProcessorAwareTrait |
||
22 | { |
||
23 | use VerifyCallableTrait; |
||
24 | |||
25 | /** |
||
26 | * @var bool |
||
27 | */ |
||
28 | protected $isProcessed = FALSE; |
||
29 | |||
30 | /** |
||
31 | * @var UniquePriorityQueue[] |
||
32 | */ |
||
33 | protected static $processors = []; |
||
34 | |||
35 | /** |
||
36 | * Execute all the processors |
||
37 | * |
||
38 | * @return $this |
||
39 | */ |
||
40 | public function process() |
||
50 | |||
51 | /** |
||
52 | * Set processors for THIS class |
||
53 | * |
||
54 | * @param callable ...$callables |
||
55 | * @return string called class name |
||
56 | * @throws \LogicException if not valid processor found |
||
57 | */ |
||
58 | public static function addProcessor(callable ...$callables): string |
||
71 | |||
72 | /** |
||
73 | * get related processors |
||
74 | * |
||
75 | * @return iterable |
||
76 | */ |
||
77 | protected static function getProcessors(): iterable |
||
90 | |||
91 | /** |
||
92 | * convert predefined processors from classProcessors() |
||
93 | */ |
||
94 | protected static function initProcessors() |
||
104 | |||
105 | /** |
||
106 | * Define processors for THIS class |
||
107 | * |
||
108 | * @return array |
||
109 | */ |
||
110 | protected static function classProcessors(): array |
||
114 | |||
115 | /** |
||
116 | * @return array |
||
117 | */ |
||
118 | protected static function getClassTree(): array |
||
128 | } |