Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 12 |
CRAP | |
0.00% |
0 / 1 |
NullStatsdDataFactory | |
0.00% |
0 / 16 |
|
0.00% |
0 / 12 |
156 | |
0.00% |
0 / 1 |
timing | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
gauge | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
set | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
increment | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
decrement | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
updateCount | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
produceStatsdData | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
hasData | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getData | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
clearData | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDataCount | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setEnabled | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | use Liuggio\StatsdClient\Entity\StatsdData; |
4 | use Liuggio\StatsdClient\Entity\StatsdDataInterface; |
5 | |
6 | /** |
7 | * @author Addshore |
8 | * @since 1.27 |
9 | */ |
10 | class NullStatsdDataFactory implements IBufferingStatsdDataFactory { |
11 | |
12 | /** |
13 | * This function creates a 'timing' StatsdData. |
14 | * |
15 | * @param string|array $key The metric(s) to set. |
16 | * @param float $time The elapsed time (ms) to log |
17 | */ |
18 | public function timing( $key, $time ) { |
19 | } |
20 | |
21 | /** |
22 | * This function creates a 'gauge' StatsdData. |
23 | * |
24 | * @param string|array $key The metric(s) to set. |
25 | * @param float $value The value for the stats. |
26 | */ |
27 | public function gauge( $key, $value ) { |
28 | } |
29 | |
30 | /** |
31 | * This function creates a 'set' StatsdData object |
32 | * A "Set" is a count of unique events. |
33 | * This data type acts like a counter, but supports counting |
34 | * of unique occurrences of values between flushes. The backend |
35 | * receives the number of unique events that happened since |
36 | * the last flush. |
37 | * |
38 | * The reference use case involved tracking the number of active |
39 | * and logged in users by sending the current userId of a user |
40 | * with each request with a key of "uniques" (or similar). |
41 | * |
42 | * @param string|array $key The metric(s) to set. |
43 | * @param float $value The value for the stats. |
44 | * |
45 | * @return array |
46 | */ |
47 | public function set( $key, $value ) { |
48 | return []; |
49 | } |
50 | |
51 | /** |
52 | * This function creates a 'increment' StatsdData object. |
53 | * |
54 | * @param string|array $key The metric(s) to increment. |
55 | * |
56 | * @return array |
57 | */ |
58 | public function increment( $key ) { |
59 | return []; |
60 | } |
61 | |
62 | /** |
63 | * This function creates a 'decrement' StatsdData object. |
64 | * |
65 | * |
66 | * @param string|array $key The metric(s) to decrement. |
67 | * |
68 | * @return mixed |
69 | */ |
70 | public function decrement( $key ) { |
71 | return []; |
72 | } |
73 | |
74 | /** |
75 | * This function creates a 'updateCount' StatsdData object. |
76 | * |
77 | * @param string|array $key The metric(s) to decrement. |
78 | * @param int $delta The delta to add to the each metric |
79 | * |
80 | * @return mixed |
81 | */ |
82 | public function updateCount( $key, $delta ) { |
83 | return []; |
84 | } |
85 | |
86 | /** |
87 | * Produce a StatsdDataInterface Object. |
88 | * |
89 | * @param string $key The key of the metric |
90 | * @param int $value The amount to increment/decrement each metric by. |
91 | * @param string $metric The metric type |
92 | * ("c" for count, "ms" for timing, "g" for gauge, "s" for set) |
93 | * |
94 | * @return StatsdDataInterface |
95 | */ |
96 | public function produceStatsdData( |
97 | $key, |
98 | $value = 1, |
99 | $metric = StatsdDataInterface::STATSD_METRIC_COUNT |
100 | ) { |
101 | $data = new StatsdData(); |
102 | $data->setKey( $key ); |
103 | $data->setValue( $value ); |
104 | $data->setMetric( $metric ); |
105 | return $data; |
106 | } |
107 | |
108 | public function hasData() { |
109 | return false; |
110 | } |
111 | |
112 | public function getData() { |
113 | return []; |
114 | } |
115 | |
116 | public function clearData() { |
117 | // Nothing to do, always empty |
118 | } |
119 | |
120 | public function getDataCount() { |
121 | return 0; |
122 | } |
123 | |
124 | public function setEnabled( $enabled ) { |
125 | // Nothing to do, null factory is always disabled. |
126 | } |
127 | } |