public function supports($object)
{
if (is_string($object)) {
$class = new \ReflectionClass($object);
$object = $class->newInstance();
}
if ( ! is_object($object)) {
throw new InvalidArgumentException(sprintf("%s expects class or object, %s given", __METHOD__, substr(str_replace("\n", '', var_export($object, true)), 0, 10)));
}
return is_a($object, $this->class);
}
/** * @expectedException Symfony\Component\DependencyInjection\Exception\InvalidArgumentException */ public function testSupportsThrowsExceptionOnInvalidArgument() { $injector = new InterfaceInjector('Symfony\\Tests\\Component\\DependencyInjection\\Service'); $injector->supports(array()); }