Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
6 / 6
CRAP
100.00% covered (success)
100.00%
1 / 1
ConfigDeleteOperation
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
6 / 6
6
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDescription
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getKey
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 execute
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toArray
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * Configuration delete operation for migrations.
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public License,
7 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
8 * obtain one at https://mozilla.org/MPL/2.0/.
9 *
10 * @package   phpMyFAQ
11 * @author    Thorsten Rinne <thorsten@phpmyfaq.de>
12 * @copyright 2023-2026 phpMyFAQ Team
13 * @license   https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
14 * @link      https://www.phpmyfaq.de
15 * @since     2026-01-25
16 */
17
18declare(strict_types=1);
19
20namespace phpMyFAQ\Setup\Migration\Operations;
21
22use phpMyFAQ\Configuration;
23
24readonly 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}