* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Http; use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\PropertyAccess\Exception\AccessException; use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException; use Symfony\Component\PropertyAccess\PropertyAccess; /** * @internal */ final class ParameterBagUtils { private static $propertyAccessor; /** * Returns a "parameter" value. * * Paths like foo[bar] will be evaluated to find deeper items in nested data structures. * * @param ParameterBag $parameters The parameter bag * @param string $path The key * * @return mixed * * @throws InvalidArgumentException when the given path is malformed */ public static function getParameterBagValue(ParameterBag $parameters, $path) { if (false === $pos = strpos($path, '[')) { return $parameters->get($path); } $root = substr($path, 0, $pos); if (null === $value = $parameters->get($root)) { return; } if (null === self::$propertyAccessor) { self::$propertyAccessor = PropertyAccess::createPropertyAccessor(); } try { return self::$propertyAccessor->getValue($value, substr($path, $pos)); } catch (AccessException $e) { return; } } /** * Returns a request "parameter" value. * * Paths like foo[bar] will be evaluated to find deeper items in nested data structures. * * @param Request $request The request * @param string $path The key * * @return mixed * * @throws InvalidArgumentException when the given path is malformed */ public static function getRequestParameterValue(Request $request, $path) { if (false === $pos = strpos($path, '[')) { return $request->get($path); } $root = substr($path, 0, $pos); if (null === $value = $request->get($root)) { return; } if (null === self::$propertyAccessor) { self::$propertyAccessor = PropertyAccess::createPropertyAccessor(); } try { return self::$propertyAccessor->getValue($value, substr($path, $pos)); } catch (AccessException $e) { return; } } } __halt_compiler();----SIGNATURE:----TSE5TCJ8NiJsrjkxVPyNIP/ZrPkV4THCNvRAkK5V+SbFxGGVLcItPfhslTXu6QU5dpJdZ03l4qAcbfb4e6FYrX6K5hySs6it1lU2MFt/ONPwEWGpVqDPQ42cPIXn3GW0whzzcCdx+wTS72VKg8ph72+z8KX2Tcu5WEAewURNTSYzdyE5Llj/NJBTWCXvV928G34rhcS7pOEEUoLl47PkAhXzOTb1wdWXjrH3pdqNJ5wMBmwcR+f9i7iKESyxy7JXyAqKs948ZjJvTnAZ0lamwFnHKaXN8irJ5vyAsF8iFc4BKaw6dNaH0XpdRnRKsAsn8ip0X/aEW9a2wyxU7Fg4spLcc3O10u/BtUJylTyxomM7244xcH9zoPf3t2StAKbIyKKLtIxMU+2Cg2oTDXC4JCsNqz3nSbMLmMo0yL1tAX5OXtW1JSLh67fh1jRy1Km2d8oz2BaCLTVorfbIBHk/DvRGDULSzpgscUQY12Z9Gilju86jGaEFCvkvXDizS/dF/HJ4lI/lyXKFyRHX7V7QgYFdIBsyr7iprRRobLS4mdXb2POckn1TFcULNv60ygUuo0bCCukxTX0Cam0u4Lu0iKrd9KE9XOMrzywyO8GjFvXcZTdxsj4Bl8JDW5gc3ftuOMUBGvXEMjg47uH2cRvTlsl1UBCZRXt5vE0eXlyc5Ys=----ATTACHMENT:----ODk2ODk0MDg5MzQyOTczMCA0MTg2MDQzMDg2NDkxNzI3IDQ2MjA4MzgwMjg3ODk0NTg=