Debian Codegraph @

includes/Settings/Config/PhpIniSink.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Settings\Config;
4
5 use Wikimedia\NormalizedException\NormalizedExceptionTrait;
6
7 /**
8 * Settings sink for values to pass to ini_set.
9 *
10 * @since 1.39
11 */
12 class PhpIniSink {
13 use NormalizedExceptionTrait;
14
15 /**
16 * Sets a php runtime configuration value using ini_set().
17 * A PHP notice is triggered if setting the value fails.
18 *
19 * @param string $option
20 * @param string $value
21 * @return void
22 */
23 public function set( string $option, string $value ): void {
24 $result = ini_set( $option, $value );
25
26 if ( $result === false ) {
27 $msg = $this->getMessageFromNormalizedMessage(
28 'Could not set option: {option} with value: {value} to PHP_INI config.',
29 [
30 'value' => $value,
31 'option' => $option,
32 ]
33 );
34 trigger_error( $msg );
35 }
36 }
37
38 }