| 1 |
<?php |
| 2 |
declare( strict_types = 1 ); |
| 3 |
|
| 4 |
namespace Wikimedia\Parsoid\Mocks; |
| 5 |
|
| 6 |
use Liuggio\StatsdClient\Entity\StatsdDataInterface; |
| 7 |
use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface; |
| 8 |
|
| 9 |
class 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 gauge( $key, $value ) { |
| 21 |
$this->log[] = [ 'gauge', $key, $value ]; |
| 22 |
} |
| 23 |
|
| 24 |
/** @inheritDoc */ |
| 25 |
public function set( $key, $value ) { |
| 26 |
$this->log[] = [ 'set', $key, $value ]; |
| 27 |
return []; |
| 28 |
} |
| 29 |
|
| 30 |
/** @inheritDoc */ |
| 31 |
public function increment( $key ) { |
| 32 |
$this->log[] = [ 'increment', $key ]; |
| 33 |
return []; |
| 34 |
} |
| 35 |
|
| 36 |
/** @inheritDoc */ |
| 37 |
public function decrement( $key ) { |
| 38 |
$this->log[] = [ 'decrement', $key ]; |
| 39 |
return []; |
| 40 |
} |
| 41 |
|
| 42 |
/** @inheritDoc */ |
| 43 |
public function updateCount( $key, $delta ) { |
| 44 |
$this->log[] = [ 'updateCount', $key, $delta ]; |
| 45 |
return []; |
| 46 |
} |
| 47 |
|
| 48 |
/** @inheritDoc */ |
| 49 |
public function produceStatsdData( |
| 50 |
$key, $value = 1, $metric = StatsdDataInterface::STATSD_METRIC_COUNT |
| 51 |
) { |
| 52 |
// @phan-suppress-next-line PhanTypeMismatchReturn FIXME, phan seems right |
| 53 |
return $metric; |
| 54 |
} |
| 55 |
|
| 56 |
} |