![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/vendor/friendsofsymfony/rest-bundle/Util/ |
<?php /* * This file is part of the FOSRestBundle package. * * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace FOS\RestBundle\Util; use Symfony\Component\DependencyInjection\ContainerInterface; /** * @author Ener-Getick <[email protected]> * * @internal do not use this trait or its functions in your code */ trait ResolverTrait { private function resolveValue(ContainerInterface $container, $value) { if (is_array($value)) { foreach ($value as $key => $val) { $value[$key] = $this->resolveValue($container, $val); } return $value; } if (!is_string($value)) { return $value; } $escapedValue = preg_replace_callback('/%%|%([^%\s]++)%/', function ($match) use ($container) { // skip %% if (!isset($match[1])) { return '%%'; } $resolved = $container->getParameter($match[1]); if (is_string($resolved) || is_numeric($resolved)) { return (string) $resolved; } throw new \RuntimeException(sprintf('The container parameter "%s" must be a string or numeric, but it is of type %s.', $match[1], gettype($resolved))); }, $value); return str_replace('%%', '%', $escapedValue); } }