| 1 | <?php |
||
| 18 | abstract class AbstractMetric extends BaseObject implements MetricInterface |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var float |
||
| 22 | */ |
||
| 23 | public $weight = 1; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | public $version = '1.0.0'; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var float |
||
| 32 | */ |
||
| 33 | private $score; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @return float |
||
| 37 | */ |
||
| 38 | abstract protected function calculateScore(): float; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @inheritdoc |
||
| 42 | * @throws \ReflectionException |
||
| 43 | */ |
||
| 44 | public static function displayName(): string |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @inheritdoc |
||
| 56 | */ |
||
| 57 | public function getVersion(): string |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @inheritdoc |
||
| 64 | */ |
||
| 65 | public function getWeight(): float |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @return float |
||
| 72 | */ |
||
| 73 | public function getScore(): float |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @return $this |
||
| 84 | */ |
||
| 85 | public function resetScore() |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @param float|null $score |
||
| 93 | * @return $this |
||
| 94 | */ |
||
| 95 | public function setScore(float $score = null) |
||
| 100 | |||
| 101 | /** |
||
| 102 | * @inheritdoc |
||
| 103 | */ |
||
| 104 | public function toConfig(): array |
||
| 113 | } |
||
| 114 |