Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
AbstractHandler | |
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
setName | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
prepare | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
prepareHeaderAsString | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
prepareAsString | n/a |
0 / 0 |
n/a |
0 / 0 |
0 |
1 | <?php |
2 | /** |
3 | * Pop PHP Framework (http://www.popphp.org/) |
4 | * |
5 | * @link https://github.com/popphp/popphp-framework |
6 | * @author Nick Sagona, III <dev@nolainteractive.com> |
7 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
8 | * @license http://www.popphp.org/license New BSD License |
9 | */ |
10 | |
11 | /** |
12 | * @namespace |
13 | */ |
14 | namespace Pop\Debug\Handler; |
15 | |
16 | /** |
17 | * Debug handler abstract class |
18 | * |
19 | * @category Pop |
20 | * @package Pop\Debug |
21 | * @author Nick Sagona, III <dev@nolainteractive.com> |
22 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
23 | * @license http://www.popphp.org/license New BSD License |
24 | * @version 2.0.0 |
25 | */ |
26 | abstract class AbstractHandler implements HandlerInterface |
27 | { |
28 | |
29 | /** |
30 | * Name of time measurement |
31 | * @var ?string |
32 | */ |
33 | protected ?string $name = null; |
34 | |
35 | /** |
36 | * Constructor |
37 | * |
38 | * Instantiate a handler object |
39 | * |
40 | * @param ?string $name |
41 | */ |
42 | public function __construct(?string $name = null) |
43 | { |
44 | if ($name !== null) { |
45 | $this->setName($name); |
46 | } |
47 | } |
48 | |
49 | /** |
50 | * Set name |
51 | * |
52 | * @param string $name |
53 | * @return AbstractHandler |
54 | */ |
55 | public function setName(string $name): AbstractHandler |
56 | { |
57 | $this->name = $name; |
58 | return $this; |
59 | } |
60 | |
61 | /** |
62 | * Get name |
63 | * |
64 | * @return ?string |
65 | */ |
66 | public function getName(): ?string |
67 | { |
68 | return $this->name; |
69 | } |
70 | |
71 | /** |
72 | * Prepare handler data for storage |
73 | * |
74 | * @return array |
75 | */ |
76 | abstract public function prepare(): array; |
77 | |
78 | /** |
79 | * Prepare header string |
80 | * |
81 | * @return string |
82 | */ |
83 | abstract public function prepareHeaderAsString(): string; |
84 | |
85 | /** |
86 | * Prepare handler data as string |
87 | * |
88 | * @return string |
89 | */ |
90 | abstract public function prepareAsString(): string; |
91 | |
92 | } |