- Exception now called if a scalar value is supposed to be returned
This commit is contained in:
parent
bc6344ad17
commit
f92baa03c8
|
@ -6,7 +6,7 @@
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Dave Mc Nicoll",
|
"name": "Dave Mc Nicoll",
|
||||||
"email": "mcndave@gmail.com"
|
"email": "info@mcnd.ca"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {},
|
"require": {},
|
||||||
|
|
|
@ -50,10 +50,6 @@ class I18n implements MissingKeyInterface
|
||||||
$string = $this->missingKey ? $this->missingKey->get($key) : null;
|
$string = $this->missingKey ? $this->missingKey->get($key) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (is_array($string)) {
|
|
||||||
# $string = json_encode($string);
|
|
||||||
#}
|
|
||||||
|
|
||||||
return $string && $variables ? $this->placeVariables($string, $variables) : $string;
|
return $string && $variables ? $this->placeVariables($string, $variables) : $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class Iterate
|
||||||
if ( ! is_iterable($recurse) ) {
|
if ( ! is_iterable($recurse) ) {
|
||||||
if ( is_object($recurse) ) {
|
if ( is_object($recurse) ) {
|
||||||
if ( count($pathArr) > 1 ) {
|
if ( count($pathArr) > 1 ) {
|
||||||
throw new \Exception("An error occured trying to fetch a value from an object using path $path");
|
throw new \Exception("An error occured trying to fetch a value from an object using path '$path'");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# @TODO An object caller would be a WAY better idea then this line of code
|
# @TODO An object caller would be a WAY better idea then this line of code
|
||||||
|
@ -67,6 +67,9 @@ class Iterate
|
||||||
return $recurse->{$pathArr[0]} ?? "";
|
return $recurse->{$pathArr[0]} ?? "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif (is_scalar($recurse)) {
|
||||||
|
throw new \Exception("An error occured trying to fetch a value from a scalar value using path '$path'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return static::arrayGet($recurse, implode($delimiter, $pathArr), $delimiter);
|
return static::arrayGet($recurse, implode($delimiter, $pathArr), $delimiter);
|
||||||
|
|
Loading…
Reference in New Issue