-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement BeforeMetricCalculate event that allows changing run option…
…s of a metric
- Loading branch information
Showing
3 changed files
with
44 additions
and
6 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
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,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Panaly\Event; | ||
|
||
use Panaly\Plugin\Plugin\Metric; | ||
|
||
final class BeforeMetricCalculate | ||
{ | ||
public function __construct( | ||
public readonly Metric $plugin, | ||
private array $options, | ||
) { | ||
} | ||
|
||
/** @return array<string, mixed> */ | ||
public function getOptions(): array | ||
{ | ||
return $this->options; | ||
} | ||
|
||
public function getOption(string $option): mixed | ||
{ | ||
return $this->options[$option] ?? null; | ||
} | ||
|
||
public function setOption(string $option, mixed $value): void | ||
{ | ||
$this->options[$option] = $value; | ||
} | ||
} |