|
@@ -60,14 +60,6 @@ class Config {
|
|
|
*/
|
|
|
public static function get($key)
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if (array_key_exists($key, static::$cache))
|
|
|
- {
|
|
|
- return static::$cache[$key];
|
|
|
- }
|
|
|
-
|
|
|
list($bundle, $file, $item) = static::parse($key);
|
|
|
|
|
|
if ( ! static::load($bundle, $file)) return;
|
|
@@ -77,9 +69,14 @@ class Config {
|
|
|
|
|
|
|
|
|
|
|
|
- $value = (is_null($item)) ? $items : array_get($items, $item);
|
|
|
-
|
|
|
- return static::$cache[$key] = $value;
|
|
|
+ if (is_null($item))
|
|
|
+ {
|
|
|
+ return $items;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return array_get($items, $item);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -102,7 +99,22 @@ class Config {
|
|
|
*/
|
|
|
public static function set($key, $value)
|
|
|
{
|
|
|
- static::$cache[$key] = $value;
|
|
|
+ list($bundle, $file, $item) = static::parse($key);
|
|
|
+
|
|
|
+ static::load($bundle, $file);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (is_null($item))
|
|
|
+ {
|
|
|
+ array_set(static::$items[$bundle], $file, $value);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ array_set(static::$items[$bundle][$file], $item, $value);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -115,6 +127,14 @@ class Config {
|
|
|
*/
|
|
|
protected static function parse($key)
|
|
|
{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (array_key_exists($key, static::$cache))
|
|
|
+ {
|
|
|
+ return static::$cache[$key];
|
|
|
+ }
|
|
|
+
|
|
|
$bundle = Bundle::name($key);
|
|
|
|
|
|
$segments = explode('.', Bundle::element($key));
|
|
@@ -124,12 +144,14 @@ class Config {
|
|
|
|
|
|
if (count($segments) >= 2)
|
|
|
{
|
|
|
- return array($bundle, $segments[0], implode('.', array_slice($segments, 1)));
|
|
|
+ $parsed = array($bundle, $segments[0], implode('.', array_slice($segments, 1)));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- return array($bundle, $segments[0], null);
|
|
|
+ $parsed = array($bundle, $segments[0], null);
|
|
|
}
|
|
|
+
|
|
|
+ return static::$cache[$key] = $parsed;
|
|
|
}
|
|
|
|
|
|
|