- Exception now called if a scalar value is supposed to be returned

This commit is contained in:
mcndave committed 2023-05-31 18:30:55 +00:00
1 parent bc6344ad17
commit f92baa03c8
3 files changed
+5 -6

No files matched your search

+4 -1
View File
@@ -59,7 +59,7 @@ class Iterate
if ( ! is_iterable($recurse) ) {
if ( is_object($recurse) ) {
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 {
# @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]} ?? "";
}
}
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);