| @@ 17-63 (lines=47) @@ | ||
| 14 | use Ndrx\Profiler\JsonPatch; |
|
| 15 | use Ndrx\Profiler\Renderer\RendererInterface; |
|
| 16 | ||
| 17 | abstract class Event extends StreamCollector implements StreamCollectorInterface |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * The path in the final json |
|
| 21 | * @example |
|
| 22 | * path /aa/bb |
|
| 23 | * will be transformed to |
|
| 24 | * { |
|
| 25 | * aa : { |
|
| 26 | * bb: <VALUE OF RESOLVE> |
|
| 27 | * } |
|
| 28 | * } |
|
| 29 | * @return mixed |
|
| 30 | */ |
|
| 31 | public function getPath() |
|
| 32 | { |
|
| 33 | return 'events'; |
|
| 34 | } |
|
| 35 | ||
| 36 | public function getDataFields() |
|
| 37 | { |
|
| 38 | return [ |
|
| 39 | 'name', 'param', 'time' |
|
| 40 | ]; |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * Write data in the datasource and clean current buffer |
|
| 45 | * @return mixed |
|
| 46 | */ |
|
| 47 | public function stream() |
|
| 48 | { |
|
| 49 | $patch = $this->jsonPatch->generate($this->getPath(), JsonPatch::ACTION_ADD, $this->data, true); |
|
| 50 | $this->dataSource->save($this->process, [$patch]); |
|
| 51 | $this->data = []; |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @return RendererInterface |
|
| 56 | * |
|
| 57 | * @throws \RuntimeException |
|
| 58 | */ |
|
| 59 | public function getRenderer() |
|
| 60 | { |
|
| 61 | return new \Ndrx\Profiler\Renderer\Html\Data\Event(); |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| @@ 16-52 (lines=37) @@ | ||
| 13 | use Ndrx\Profiler\Collectors\StreamCollector; |
|
| 14 | use Ndrx\Profiler\JsonPatch; |
|
| 15 | ||
| 16 | abstract class Mail extends StreamCollector implements StreamCollectorInterface |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * The path in the final json |
|
| 20 | * @example |
|
| 21 | * path /aa/bb |
|
| 22 | * will be transformed to |
|
| 23 | * { |
|
| 24 | * aa : { |
|
| 25 | * bb: <VALUE OF RESOLVE> |
|
| 26 | * } |
|
| 27 | * } |
|
| 28 | * @return mixed |
|
| 29 | */ |
|
| 30 | public function getPath() |
|
| 31 | { |
|
| 32 | return 'mails'; |
|
| 33 | } |
|
| 34 | ||
| 35 | public function getDataFields() |
|
| 36 | { |
|
| 37 | return [ |
|
| 38 | 'from', 'to', 'subject', 'content' |
|
| 39 | ]; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Write data in the datasource and clean current buffer |
|
| 44 | * @return mixed |
|
| 45 | */ |
|
| 46 | public function stream() |
|
| 47 | { |
|
| 48 | $patch = $this->jsonPatch->generate($this->getPath(), JsonPatch::ACTION_ADD, $this->data, true); |
|
| 49 | $this->dataSource->save($this->process, [$patch]); |
|
| 50 | $this->data = []; |
|
| 51 | } |
|
| 52 | } |
|
| 53 | ||
| @@ 17-63 (lines=47) @@ | ||
| 14 | use Ndrx\Profiler\JsonPatch; |
|
| 15 | use Ndrx\Profiler\Renderer\RendererInterface; |
|
| 16 | ||
| 17 | abstract class Template extends StreamCollector implements StreamCollectorInterface |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * The path in the final json |
|
| 21 | * @example |
|
| 22 | * path /aa/bb |
|
| 23 | * will be transformed to |
|
| 24 | * { |
|
| 25 | * aa : { |
|
| 26 | * bb: <VALUE OF RESOLVE> |
|
| 27 | * } |
|
| 28 | * } |
|
| 29 | * @return mixed |
|
| 30 | */ |
|
| 31 | public function getPath() |
|
| 32 | { |
|
| 33 | return 'template'; |
|
| 34 | } |
|
| 35 | ||
| 36 | public function getDataFields() |
|
| 37 | { |
|
| 38 | return [ |
|
| 39 | 'name', 'data', 'time', 'file' |
|
| 40 | ]; |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * Write data in the datasource and clean current buffer |
|
| 45 | * @return mixed |
|
| 46 | */ |
|
| 47 | public function stream() |
|
| 48 | { |
|
| 49 | $patch = $this->jsonPatch->generate($this->getPath(), JsonPatch::ACTION_ADD, $this->data, true); |
|
| 50 | $this->dataSource->save($this->process, [$patch]); |
|
| 51 | $this->data = []; |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @return RendererInterface |
|
| 56 | * |
|
| 57 | * @throws \RuntimeException |
|
| 58 | */ |
|
| 59 | public function getRenderer() |
|
| 60 | { |
|
| 61 | return new \Ndrx\Profiler\Renderer\Html\Data\Template(); |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||