Lines
100.00%
10 / 10
Methods
100.00%
6 / 6
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| getType | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| getDescription | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| getKey | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| execute | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| toArray | 100.00% | 5 / 5 | 100.00% | 1 / 1 | 1 | ||
| 24 | readonly class ConfigDeleteOperation implements OperationInterface | |
| 25 | { | |
| 26 | public function __construct( | |
| 27 | private Configuration $configuration, | |
| 28 | private string $key, | |
| 29 | ) { | |
| 30 | } | |
| 31 | ||
| 32 | public function getType(): string | |
| 33 | { | |
| 34 | return 'config_delete'; | |
| 35 | } | |
| 36 | ||
| 37 | public function getDescription(): string | |
| 38 | { | |
| 39 | return sprintf('Delete configuration: %s', $this->key); | |
| 40 | } | |
| 41 | ||
| 42 | public function getKey(): string | |
| 43 | { | |
| 44 | return $this->key; | |
| 45 | } | |
| 46 | ||
| 47 | public function execute(): bool | |
| 48 | { | |
| 49 | return $this->configuration->delete($this->key); | |
| 50 | } | |
| 51 | ||
| 52 | public function toArray(): array | |
| 53 | { | |
| 54 | return [ | |
| 55 | 'type' => $this->getType(), | |
| 56 | 'description' => $this->getDescription(), | |
| 57 | 'key' => $this->key, | |
| 58 | ]; | |
| 59 | } | |
| 60 | } |