ekino /
drupal-debug
| 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
Loading history...
|
|||
| 31 | 4 | })->bindTo($settings, $settings)(); |
|
| 32 | |||
| 33 | 4 | PropertyAccess::createPropertyAccessor()->setValue($storage, $propertyPath, $value); |
|
| 34 | 4 | } |
|
| 35 | } |
||
| 36 |