Update Kirby and dependencies
This commit is contained in:
parent
503b339974
commit
399fa20902
439 changed files with 66915 additions and 64442 deletions
|
@ -18,31 +18,31 @@ namespace Kirby\Cms;
|
|||
*/
|
||||
class Nest
|
||||
{
|
||||
/**
|
||||
* @param $data
|
||||
* @param null $parent
|
||||
* @return mixed
|
||||
*/
|
||||
public static function create($data, $parent = null)
|
||||
{
|
||||
if (is_scalar($data) === true) {
|
||||
return new Field($parent, $data, $data);
|
||||
}
|
||||
/**
|
||||
* @param $data
|
||||
* @param null $parent
|
||||
* @return mixed
|
||||
*/
|
||||
public static function create($data, $parent = null)
|
||||
{
|
||||
if (is_scalar($data) === true) {
|
||||
return new Field($parent, $data, $data);
|
||||
}
|
||||
|
||||
$result = [];
|
||||
$result = [];
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
if (is_array($value) === true) {
|
||||
$result[$key] = static::create($value, $parent);
|
||||
} elseif (is_scalar($value) === true) {
|
||||
$result[$key] = new Field($parent, $key, $value);
|
||||
}
|
||||
}
|
||||
foreach ($data as $key => $value) {
|
||||
if (is_array($value) === true) {
|
||||
$result[$key] = static::create($value, $parent);
|
||||
} elseif (is_scalar($value) === true) {
|
||||
$result[$key] = new Field($parent, $key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_int(key($data))) {
|
||||
return new NestCollection($result);
|
||||
} else {
|
||||
return new NestObject($result);
|
||||
}
|
||||
}
|
||||
if (is_int(key($data))) {
|
||||
return new NestCollection($result);
|
||||
} else {
|
||||
return new NestObject($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue