-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8e998f
commit bc1517c
Showing
1 changed file
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<?php | ||
|
||
namespace Cosmastech\StatsDClientAdapter\Tests\Doubles; | ||
|
||
use DataDog\DogStatsd; | ||
|
||
class DogStatsDSpy extends DogStatsd | ||
{ | ||
/** @var array<int, array<string, mixed>> */ | ||
public array $timings = []; | ||
|
||
/** @var array<int, array<string, mixed>> */ | ||
public array $gauges = []; | ||
|
||
/** @var array<int, array<string, mixed>> */ | ||
public array $histograms = []; | ||
|
||
/** @var array<int, array<string, mixed>> */ | ||
public array $distributions = []; | ||
|
||
/** @var array<int, array<string, mixed>> */ | ||
public array $sets = []; | ||
|
||
/** @var array<int, array<string, mixed>> */ | ||
public array $increments = []; | ||
|
||
/** @var array<int, array<string, mixed>> */ | ||
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<int, mixed> $stats | ||
* @param array<int, mixed>|string $tags | ||
*/ | ||
public function increment( | ||
$stats, | ||
$sampleRate = 1.0, | ||
$tags = null, | ||
$value = 1 | ||
) { | ||
$this->increments[] = compact('stats', 'value', 'sampleRate', 'tags'); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
* @param string|array<int, mixed> $stats | ||
* @param array<int, mixed>|string $tags | ||
*/ | ||
public function decrement($stats, $sampleRate = 1.0, $tags = null, $value = -1) | ||
{ | ||
$this->decrements[] = compact('stats', 'value', 'sampleRate', 'tags'); | ||
} | ||
} |