* * 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:----UFrqy7aMh4GlLkJWGcSyc4uKDfZ8dJxtc6NrDoS5JSGYvjtOGoBxus2amtan7MQaN1VEIqGQGQtABHCasj9Zr2Wj1eMuocIad8okut/daI7Y+FZDAaEw6eI+0lVozjFcJzgpeLL5sjjnfjfiW4epet5WMvIF91umZgR3w8b4VVdLimOJi+y1kgX6IvGIR+0m3gxuCqnK9U0/mK4KIIJoQ/21uuzT+HNQNCRH1F4mBoMcI1cD058JUe7rEVyqcui6OgVXo3LUzCLkQRf2aGnXrpn2kI3em+E32eB/mJBhmIrbkTxjs3diHr+QwSwgl4kI718WrWdd98pRpOoYkATpNvs7NUKeFWfrJBpWZ9ALy63LG49BE9Qvkg72x9rlPtHeYcbh2c288o/s6JbAD6LKTb3QZ6ei+7fXwZ5cKxUsLs7djFhZNtJE+CnlFYgGv3XuKJ5kPbgVPZUvIv+CLHAQ/tmidvzGmi98LbdhjSUEyk0Vn0Y35b1Whs3b/Ry/jTXp++XA5qCO4GqnafKWSBjSmTEVRDH1sb5BIUPq5w5TXh+yaRoGn/gsjTmffKeSvx9aZNupHlkyTiDLS9Q0MjDwkQ4y+saAy9Hbl11G1Fts/a/y3nKvUoLW1GPpdnzELHUT6GuBUlVhwr6vHuZIL4AN1zfl6PeRAoVMUI1xJKjGx88=----ATTACHMENT:----NTA4NDYxMzEyNTM1OTE3NyA5NTkxNjY0NTA1MzY2NDE0IDQ3MzA2MzYyOTg2NzYzNzc=