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