-
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.
Allow setting default tags on StatsDClientAdapter (#5)
* SetDefaultTagsTrait * tests * moving around methods * rename trait * bump logger spy
- Loading branch information
1 parent
6158623
commit f5b52ee
Showing
14 changed files
with
251 additions
and
45 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
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,34 @@ | ||
<?php | ||
|
||
namespace Cosmastech\StatsDClientAdapter\Adapters\Concerns; | ||
|
||
trait HasDefaultTagsTrait | ||
{ | ||
protected array $defaultTags = []; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getDefaultTags(): array | ||
{ | ||
return $this->defaultTags; | ||
} | ||
|
||
/** | ||
* @param array<string, mixed> $tags | ||
* @return void | ||
*/ | ||
protected function setDefaultTags(array $defaultTags = []): void | ||
{ | ||
$this->defaultTags = $defaultTags; | ||
} | ||
|
||
/** | ||
* @param array<string, mixed> $tags | ||
* @return array<string, mixed> | ||
*/ | ||
protected function mergeTags(array $tags): array | ||
{ | ||
return array_merge($this->getDefaultTags(), $tags); | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.