SettingsHelper   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 15
ccs 5
cts 5
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A override() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the ekino Drupal Debug project.
7
 *
8
 * (c) ekino
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Ekino\Drupal\Debug\Helper;
15
16
use Drupal\Core\Site\Settings;
17
use Symfony\Component\PropertyAccess\PropertyAccess;
18
19
class SettingsHelper
20
{
21
    /**
22
     * @param string $propertyPath
23
     * @param mixed  $value
24
     */
25 4
    public function override(string $propertyPath, $value): void
26
    {
27 4
        $settings = Settings::getInstance();
28
29
        $storage = &(function &() {
30 4
            return $this->storage;
0 ignored issues
show
Bug Best Practice introduced by
The property storage does not exist on Ekino\Drupal\Debug\Helper\SettingsHelper. Did you maybe forget to declare it?
Loading history...
31 4
        })->bindTo($settings, $settings)();
32
33 4
        PropertyAccess::createPropertyAccessor()->setValue($storage, $propertyPath, $value);
34 4
    }
35
}
36