1 | <?php |
||
10 | trait HasProcessor |
||
11 | { |
||
12 | /** |
||
13 | * @var AbstractProcessor |
||
14 | */ |
||
15 | protected $processor; |
||
16 | |||
17 | /** |
||
18 | * Use custom formatter. |
||
19 | * |
||
20 | * @param callable|Formatter|string $formatter |
||
21 | * @return $this |
||
22 | */ |
||
23 | 2 | public function useFormatter($formatter) |
|
28 | |||
29 | /** |
||
30 | * Restore default formatter. |
||
31 | * |
||
32 | * @return $this |
||
33 | */ |
||
34 | 1 | public function restoreFormatter() |
|
39 | |||
40 | /** |
||
41 | * Get result from external resources. |
||
42 | * |
||
43 | * @param Query $query |
||
44 | * @param mixed $rows |
||
45 | * @return mixed |
||
46 | */ |
||
47 | 2 | public function process(Query $query, $rows) |
|
51 | |||
52 | /** |
||
53 | * Use custom processor. |
||
54 | * |
||
55 | * @param AbstractProcessor|string $processor |
||
56 | * @return $this |
||
57 | */ |
||
58 | 1 | public function useProcessor($processor) |
|
63 | |||
64 | /** |
||
65 | * Validate processor and return in normalized form. |
||
66 | * |
||
67 | * @param mixed $processor |
||
68 | * @return AbstractProcessor |
||
69 | */ |
||
70 | 1 | protected static function validateProcessor($processor) |
|
77 | } |
||
78 |