10000 gist:dfa95e44db53a9954f60 · GitHub
[go: up one dir, main page]

Skip to content

Instantly share code, notes, and snippets.

@wouterj
Created February 28, 2014 14:57
Show Gist options
  • Save wouterj/dfa95e44db53a9954f60 to your computer and use it in GitHub Desktop.
Save wouterj/dfa95e44db53a9954f60 to your computer and use it in GitHub Desktop.
<?php
class BcArgumentResolver implements ArgumentResolverInterface
{
protected $resolver;
protected $resolvedArguments;
/**
* @param $resolver The ControllerResolver to use
*/
public function __construct(\ControllerResolverInterface $resolver)
{
$this->resolver = $resolver;
}
public function accepts(\ReflectionParameter $parameter, Request $request)
{
try {
$this->resolvedArguments = $this->resolver->getArguments($request, $parameter->getClass(), array($parameter));
} catch (\RuntimeException $e) {
return false;
}
return true;
}
public function resolve(\ReflectionParameter $parameter, Request $request)
{
return $this->resolvedArguments;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
0