Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 8
CRAP
0.00% covered (danger)
0.00%
0 / 1
MockMetrics
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 8
72
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
 histogram
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 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 increment
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 decrement
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 updateCount
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 produceStatsdData
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2declare( strict_types = 1 );
3
4namespace Wikimedia\Parsoid\Mocks;
5
6use Liuggio\StatsdClient\Entity\StatsdDataInterface;
7use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
8
9class MockMetrics implements StatsdDataFactoryInterface {
10
11    /** @var array */
12    public $log;
13
14    /** @inheritDoc */
15    public function timing( $key, $time ) {
16        $this->log[] = [ 'timing', $key, $time ];
17    }
18
19    /** @inheritDoc */
20    public function histogram( string $key, float $value, array $buckets, array $labels ) {
21        $this->log[] = [ 'histogram', $key, $value, $buckets, $labels ];
22    }
23
24    /** @inheritDoc */
25    public function gauge( $key, $value ) {
26        $this->log[] = [ 'gauge', $key, $value ];
27    }
28
29    /** @inheritDoc */
30    public function set( $key, $value ) {
31        $this->log[] = [ 'set', $key, $value ];
32        return [];
33    }
34
35    /** @inheritDoc */
36    public function increment( $key ) {
37        $this->log[] = [ 'increment', $key ];
38        return [];
39    }
40
41    /** @inheritDoc */
42    public function decrement( $key ) {
43        $this->log[] = [ 'decrement', $key ];
44        return [];
45    }
46
47    /** @inheritDoc */
48    public function updateCount( $key, $delta ) {
49        $this->log[] = [ 'updateCount', $key, $delta ];
50        return [];
51    }
52
53    /** @inheritDoc */
54    public function produceStatsdData(
55        $key, $value = 1, $metric = StatsdDataInterface::STATSD_METRIC_COUNT
56    ) {
57        // @phan-suppress-next-line PhanTypeMismatchReturn FIXME, phan seems right
58        return $metric;
59    }
60
61}