Skip to content

Commit

Permalink
[TASK] Respect ContainerInterface in StandardVariableProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
o-ba authored Sep 9, 2024
1 parent 8fa9173 commit 6690be9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Core/Variables/StandardVariableProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace TYPO3Fluid\Fluid\Core\Variables;

use Psr\Container\ContainerInterface;

/**
* Class StandardVariableProvider
*/
Expand Down Expand Up @@ -117,6 +119,10 @@ public function getByPath(string $path): mixed
continue;
}
if (is_object($subject)) {
if ($subject instanceof ContainerInterface && $subject->has($pathSegment)) {
$subject = $subject->get($pathSegment);
continue;
}
$upperCasePropertyName = ucfirst($pathSegment);
$getMethod = 'get' . $upperCasePropertyName;
if (method_exists($subject, $getMethod)) {
Expand Down

0 comments on commit 6690be9

Please sign in to comment.