From bc1517cdf7ff903e6653836fb1d00d9035d4b62a Mon Sep 17 00:00:00 2001 From: Luke Kuzmish Date: Sun, 21 Jul 2024 08:56:32 -0400 Subject: [PATCH] DogStatsDSpy --- tests/Doubles/DogStatsDSpy.php | 103 +++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 tests/Doubles/DogStatsDSpy.php diff --git a/tests/Doubles/DogStatsDSpy.php b/tests/Doubles/DogStatsDSpy.php new file mode 100644 index 0000000..f4708c8 --- /dev/null +++ b/tests/Doubles/DogStatsDSpy.php @@ -0,0 +1,103 @@ +> */ + public array $timings = []; + + /** @var array> */ + public array $gauges = []; + + /** @var array> */ + public array $histograms = []; + + /** @var array> */ + public array $distributions = []; + + /** @var array> */ + public array $sets = []; + + /** @var array> */ + public array $increments = []; + + /** @var array> */ + public array $decrements = []; + + public function __construct() + { + // we do not need any of the parent constructor functionality + } + + /** + * @inheritDoc + * @phpstan-ignore missingType.iterableValue + */ + public function timing($stat, $time, $sampleRate = 1.0, $tags = null) + { + $this->timings[] = compact('stat', 'time', 'sampleRate', 'tags'); + } + + /** + * @inheritDoc + * @phpstan-ignore missingType.iterableValue + */ + public function gauge($stat, $value, $sampleRate = 1.0, $tags = null) + { + $this->gauges[] = compact('stat', 'value', 'sampleRate', 'tags'); + } + + /** + * @inheritDoc + * @phpstan-ignore missingType.iterableValue + */ + public function histogram($stat, $value, $sampleRate = 1.0, $tags = null) + { + $this->histograms[] = compact('stat', 'value', 'sampleRate', 'tags'); + } + + /** + * @inheritDoc + * @phpstan-ignore missingType.iterableValue + */ + public function distribution($stat, $value, $sampleRate = 1.0, $tags = null) + { + $this->distributions[] = compact('stat', 'value', 'sampleRate', 'tags'); + } + + /** + * @inheritdoc + * @phpstan-ignore missingType.iterableValue + */ + public function set($stat, $value, $sampleRate = 1.0, $tags = null) + { + $this->sets[] = compact('stat', 'value', 'sampleRate', 'tags'); + } + + /** + * @inheritDoc + * @param string|array $stats + * @param array|string $tags + */ + public function increment( + $stats, + $sampleRate = 1.0, + $tags = null, + $value = 1 + ) { + $this->increments[] = compact('stats', 'value', 'sampleRate', 'tags'); + } + + /** + * @inheritdoc + * @param string|array $stats + * @param array|string $tags + */ + public function decrement($stats, $sampleRate = 1.0, $tags = null, $value = -1) + { + $this->decrements[] = compact('stats', 'value', 'sampleRate', 'tags'); + } +}