Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4148886
ArrayConfigBuilder.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ArrayConfigBuilder.php
View Options
<?php
namespace
MediaWiki\Settings\Config
;
use
MediaWiki\Config\HashConfig
;
use
MediaWiki\Config\IterableConfig
;
use
function
array_key_exists
;
class
ArrayConfigBuilder
extends
ConfigBuilderBase
{
/** @var array */
protected
$config
=
[];
protected
function
has
(
string
$key
):
bool
{
return
array_key_exists
(
$key
,
$this
->
config
);
}
/** @inheritDoc */
public
function
get
(
string
$key
)
{
return
$this
->
config
[
$key
]
??
null
;
}
/** @inheritDoc */
protected
function
update
(
string
$key
,
$value
)
{
$this
->
config
[
$key
]
=
$value
;
}
public
function
setMulti
(
array
$values
,
array
$mergeStrategies
=
[]
):
ConfigBuilder
{
if
(
!
$mergeStrategies
)
{
$this
->
config
=
array_merge
(
$this
->
config
,
$values
);
return
$this
;
}
foreach
(
$values
as
$key
=>
$newValue
)
{
// Optimization: Inlined logic from set() for performance
if
(
array_key_exists
(
$key
,
$this
->
config
)
)
{
$mergeStrategy
=
$mergeStrategies
[
$key
]
??
null
;
if
(
$mergeStrategy
&&
is_array
(
$newValue
)
)
{
$oldValue
=
$this
->
config
[
$key
];
if
(
$oldValue
&&
is_array
(
$oldValue
)
)
{
$newValue
=
$mergeStrategy
->
merge
(
$oldValue
,
$newValue
);
}
}
}
$this
->
config
[
$key
]
=
$newValue
;
}
return
$this
;
}
/**
* Build the configuration.
*/
public
function
build
():
IterableConfig
{
return
new
HashConfig
(
$this
->
config
);
}
/** @inheritDoc */
public
function
setMultiDefault
(
$defaults
,
$mergeStrategies
):
ConfigBuilder
{
foreach
(
$defaults
as
$key
=>
$defaultValue
)
{
// Optimization: Inlined logic from setDefault() for performance
if
(
array_key_exists
(
$key
,
$this
->
config
)
)
{
$mergeStrategy
=
$mergeStrategies
[
$key
]
??
null
;
if
(
$mergeStrategy
&&
$defaultValue
&&
is_array
(
$defaultValue
)
)
{
$customValue
=
$this
->
config
[
$key
];
if
(
is_array
(
$customValue
)
)
{
$newValue
=
$mergeStrategy
->
merge
(
$defaultValue
,
$customValue
);
$this
->
config
[
$key
]
=
$newValue
;
}
}
}
else
{
$this
->
config
[
$key
]
=
$defaultValue
;
}
}
return
$this
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 19 2026, 18:58 (6 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
34/60/4b4ff4eada9a09ded7759d191da5
Default Alt Text
ArrayConfigBuilder.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment