mirror of
https://github.com/getgrav/grav.git
synced 2025-10-26 07:56:07 +01:00
Fix undefined variable in Config class
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
# v1.0.0-refactor
|
||||
## XX/XX/2015
|
||||
|
||||
1. [](#new)
|
||||
* Refactor Data classes to use NestedArrayAccess instead of DataMutatorTrait
|
||||
|
||||
# v1.0.0-rc.4
|
||||
## 10/29/2015
|
||||
|
||||
|
||||
@@ -21,9 +21,15 @@
|
||||
"mrclay/minify": "~2.2",
|
||||
"donatj/phpuseragentparser": "~0.3",
|
||||
"pimple/pimple": "~3.0",
|
||||
"rockettheme/toolbox": "1.1.*",
|
||||
"rockettheme/toolbox": "dev-develop",
|
||||
"maximebf/debugbar": "~1.10"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/rockettheme/toolbox"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Grav\\": "system/src/Grav"
|
||||
|
||||
43
composer.lock
generated
43
composer.lock
generated
@@ -1,23 +1,24 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "e1db721096772d41f16003b39b47c85a",
|
||||
"hash": "3633e92a6e340a26229689d9b74031c2",
|
||||
"content-hash": "9c314f997d29d7a78d3cf14f5976e6df",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/cache",
|
||||
"version": "v1.5.0",
|
||||
"version": "v1.5.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/cache.git",
|
||||
"reference": "eb8a73619af4f1c8711e2ce482f5de3643258a1f"
|
||||
"reference": "2b9cec5a5e722010cbebc91713d4c11eaa064d5e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/cache/zipball/eb8a73619af4f1c8711e2ce482f5de3643258a1f",
|
||||
"reference": "eb8a73619af4f1c8711e2ce482f5de3643258a1f",
|
||||
"url": "https://api.github.com/repos/doctrine/cache/zipball/2b9cec5a5e722010cbebc91713d4c11eaa064d5e",
|
||||
"reference": "2b9cec5a5e722010cbebc91713d4c11eaa064d5e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -74,7 +75,7 @@
|
||||
"cache",
|
||||
"caching"
|
||||
],
|
||||
"time": "2015-10-28 11:27:45"
|
||||
"time": "2015-11-02 18:35:48"
|
||||
},
|
||||
{
|
||||
"name": "donatj/phpuseragentparser",
|
||||
@@ -665,16 +666,16 @@
|
||||
},
|
||||
{
|
||||
"name": "rockettheme/toolbox",
|
||||
"version": "1.1.4",
|
||||
"version": "dev-develop",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rockettheme/toolbox.git",
|
||||
"reference": "ff677d8f66d1addd3590d0cb85bcbaff4174d9c9"
|
||||
"reference": "0a7006b00880bd6873c49e2ed23939c785310417"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/rockettheme/toolbox/zipball/ff677d8f66d1addd3590d0cb85bcbaff4174d9c9",
|
||||
"reference": "ff677d8f66d1addd3590d0cb85bcbaff4174d9c9",
|
||||
"url": "https://api.github.com/repos/rockettheme/toolbox/zipball/0a7006b00880bd6873c49e2ed23939c785310417",
|
||||
"reference": "0a7006b00880bd6873c49e2ed23939c785310417",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -700,7 +701,6 @@
|
||||
"RocketTheme\\Toolbox\\StreamWrapper\\": "StreamWrapper/src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@@ -710,7 +710,11 @@
|
||||
"php",
|
||||
"rockettheme"
|
||||
],
|
||||
"time": "2015-10-15 23:27:40"
|
||||
"support": {
|
||||
"source": "https://github.com/rockettheme/toolbox/tree/develop",
|
||||
"issues": "https://github.com/rockettheme/toolbox/issues"
|
||||
},
|
||||
"time": "2015-11-13 11:39:58"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
@@ -929,16 +933,16 @@
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v1.23.0",
|
||||
"version": "v1.23.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/Twig.git",
|
||||
"reference": "5868cd822fd6cf626d5f805439575f9c323cee2a"
|
||||
"reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/5868cd822fd6cf626d5f805439575f9c323cee2a",
|
||||
"reference": "5868cd822fd6cf626d5f805439575f9c323cee2a",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/d9b6333ae8dd2c8e3fd256e127548def0bc614c6",
|
||||
"reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -986,14 +990,15 @@
|
||||
"keywords": [
|
||||
"templating"
|
||||
],
|
||||
"time": "2015-10-29 23:29:01"
|
||||
"time": "2015-11-05 12:49:06"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": {
|
||||
"filp/whoops": 20
|
||||
"filp/whoops": 20,
|
||||
"rockettheme/toolbox": 20
|
||||
},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
|
||||
@@ -3,6 +3,7 @@ namespace Grav\Common\Data;
|
||||
|
||||
use Grav\Common\GravTrait;
|
||||
use RocketTheme\Toolbox\ArrayTraits\Export;
|
||||
use RocketTheme\Toolbox\ArrayTraits\NestedArrayAccess;
|
||||
|
||||
/**
|
||||
* Blueprint handles the inside logic of blueprints.
|
||||
@@ -12,7 +13,7 @@ use RocketTheme\Toolbox\ArrayTraits\Export;
|
||||
*/
|
||||
class Blueprint
|
||||
{
|
||||
use Export, DataMutatorTrait, GravTrait;
|
||||
use Export, NestedArrayAccess, GravTrait;
|
||||
|
||||
public $name;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace Grav\Common\Data;
|
||||
|
||||
use RocketTheme\Toolbox\ArrayTraits\ArrayAccessWithGetters;
|
||||
use RocketTheme\Toolbox\ArrayTraits\Countable;
|
||||
use RocketTheme\Toolbox\ArrayTraits\Export;
|
||||
use RocketTheme\Toolbox\ArrayTraits\NestedArrayAccessWithGetters;
|
||||
use RocketTheme\Toolbox\File\File;
|
||||
use RocketTheme\Toolbox\File\FileInterface;
|
||||
|
||||
@@ -15,7 +15,7 @@ use RocketTheme\Toolbox\File\FileInterface;
|
||||
*/
|
||||
class Data implements DataInterface
|
||||
{
|
||||
use ArrayAccessWithGetters, Countable, Export, DataMutatorTrait;
|
||||
use NestedArrayAccessWithGetters, Countable, Export;
|
||||
|
||||
protected $gettersVariable = 'items';
|
||||
protected $items;
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
namespace Grav\Common\Data;
|
||||
|
||||
trait DataMutatorTrait
|
||||
{
|
||||
|
||||
/**
|
||||
* Get value by using dot notation for nested arrays/objects.
|
||||
*
|
||||
* @example $value = $data->get('this.is.my.nested.variable');
|
||||
*
|
||||
* @param string $name Dot separated path to the requested value.
|
||||
* @param mixed $default Default value (or null).
|
||||
* @param string $separator Separator, defaults to '.'
|
||||
* @return mixed Value.
|
||||
*/
|
||||
public function get($name, $default = null, $separator = '.')
|
||||
{
|
||||
$path = explode($separator, $name);
|
||||
$current = $this->items;
|
||||
foreach ($path as $field) {
|
||||
if (is_object($current) && isset($current->{$field})) {
|
||||
$current = $current->{$field};
|
||||
} elseif (is_array($current) && isset($current[$field])) {
|
||||
$current = $current[$field];
|
||||
} else {
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
||||
return $current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value by using dot notation for nested arrays/objects.
|
||||
*
|
||||
* @example $value = $data->set('this.is.my.nested.variable', true);
|
||||
*
|
||||
* @param string $name Dot separated path to the requested value.
|
||||
* @param mixed $value New value.
|
||||
* @param string $separator Separator, defaults to '.'
|
||||
*/
|
||||
public function set($name, $value, $separator = '.')
|
||||
{
|
||||
$path = explode($separator, $name);
|
||||
$current = &$this->items;
|
||||
foreach ($path as $field) {
|
||||
if (is_object($current)) {
|
||||
// Handle objects.
|
||||
if (!isset($current->{$field})) {
|
||||
$current->{$field} = array();
|
||||
}
|
||||
$current = &$current->{$field};
|
||||
} else {
|
||||
// Handle arrays and scalars.
|
||||
if (!is_array($current)) {
|
||||
$current = array($field => array());
|
||||
} elseif (!isset($current[$field])) {
|
||||
$current[$field] = array();
|
||||
}
|
||||
$current = &$current[$field];
|
||||
}
|
||||
}
|
||||
|
||||
$current = $value;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user