* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpKernel\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Controller\ArgumentResolver\DefaultValueResolver; use Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestAttributeValueResolver; use Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestValueResolver; use Symfony\Component\HttpKernel\Controller\ArgumentResolver\SessionValueResolver; use Symfony\Component\HttpKernel\Controller\ArgumentResolver\VariadicValueResolver; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactory; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactoryInterface; /** * Responsible for resolving the arguments passed to an action. * * @author Iltar van der Berg */ final class ArgumentResolver implements ArgumentResolverInterface { private $argumentMetadataFactory; /** * @var iterable|ArgumentValueResolverInterface[] */ private $argumentValueResolvers; public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, $argumentValueResolvers = array()) { $this->argumentMetadataFactory = $argumentMetadataFactory ?: new ArgumentMetadataFactory(); $this->argumentValueResolvers = $argumentValueResolvers ?: self::getDefaultArgumentValueResolvers(); } /** * {@inheritdoc} */ public function getArguments(Request $request, $controller) { $arguments = array(); foreach ($this->argumentMetadataFactory->createArgumentMetadata($controller) as $metadata) { foreach ($this->argumentValueResolvers as $resolver) { if (!$resolver->supports($request, $metadata)) { continue; } $resolved = $resolver->resolve($request, $metadata); if (!$resolved instanceof \Generator) { throw new \InvalidArgumentException(sprintf('%s::resolve() must yield at least one value.', get_class($resolver))); } foreach ($resolved as $append) { $arguments[] = $append; } // continue to the next controller argument continue 2; } $representative = $controller; if (is_array($representative)) { $representative = sprintf('%s::%s()', get_class($representative[0]), $representative[1]); } elseif (is_object($representative)) { $representative = get_class($representative); } throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.', $representative, $metadata->getName())); } return $arguments; } public static function getDefaultArgumentValueResolvers() { return array( new RequestAttributeValueResolver(), new RequestValueResolver(), new SessionValueResolver(), new DefaultValueResolver(), new VariadicValueResolver(), ); } } __halt_compiler();----SIGNATURE:----ht4a0vIB5dl9O5hOoZrvck2r0zsecicSckp+6BkZKGSQ2cJdB+pQi+NkJRtSfCUvFkejkQWFn5nDASq1lus+TJRBEzYlFJNyXnwhk4vovUZfxnmXcaeXDweexBCsmtNNVSHhlAaU0kqAg13eSxB5LYrJVQnOMyLKLZsS+GpFNbE+kYG2QWKJV0XKwAoWJYCct6UVe6lbWwVF5ycN8yiRPHrxNH1GOP7rVm97nl8Hf+VE3M17dIex48EioE2TV6Lg3EZs6++jReJlgcZd2AQLDj0OxbIrAqeJyd+lofFsM+KQ7ljWsC1eiF0Famd5dRm22+oRoE/gLUhYPTH5xb134hX5nIt40Zgwm3mIqpJmok+nsJ8CoQXhCmd/SgtBYGMJ+9orhBGtahZRJMEcqROddJ1rSEd42MWgF0LuKqhoKX2iJWihBnGgsxjylrYihHow8+o8R5UVQss0rD2jHuvHE0oUT3L8opJQ2SgkRVR+7WUUsrPFy+rSQzUM1HBqwSNYkJnvxkkHZJmxbww1RgdD3Sp1abho/T9YRoTJms4XvEDbsVWU1twduLx9sZCkU6JQZS9FaCioj+j2sg0CapwQVveQBhdtZlytnwnlcBxwL4C02Rp0j4Ch8m6F5nA/YN2ov3NlPRq0TMbH7RFwJSJCzKnjQsrEHkQxTW3netVsjBk=----ATTACHMENT:----MTQ2ODA5NjgwMjA4NjQ2NCA0MDM3MzE4MTM0MzE2MDA3IDc1MTg5NDQxNTY0MTM0Mw==