2014-09-05 20:08:54 +02:00
|
|
|
<?php
|
|
|
|
namespace Szurubooru\Tests;
|
2014-10-08 14:47:47 +02:00
|
|
|
use Szurubooru\Config;
|
2014-09-05 20:08:54 +02:00
|
|
|
|
2014-10-08 14:47:47 +02:00
|
|
|
final class ConfigMock extends Config
|
2014-09-05 20:08:54 +02:00
|
|
|
{
|
2015-11-25 09:48:03 +01:00
|
|
|
public function set($key, $value)
|
|
|
|
{
|
|
|
|
$keys = preg_split('/[\\/]/', $key);
|
|
|
|
$current = $this;
|
|
|
|
$lastKey = array_pop($keys);
|
|
|
|
foreach ($keys as $key)
|
|
|
|
{
|
|
|
|
if (!isset($current->$key))
|
|
|
|
$current->$key = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
|
|
|
|
$current = $current->$key;
|
|
|
|
}
|
|
|
|
$current->$lastKey = $value;
|
|
|
|
}
|
2014-09-05 20:08:54 +02:00
|
|
|
}
|