public function get($alias)
{
if (parent::has($alias)) {
return parent::get($alias);
}
$service = $this->serviceLocator;
if (!$service->has($alias)) {
throw new \InvalidArgumentException(sprintf('There is no "%s" filter in ZF2 service manager.', $alias));
}
$filter = $service->get($alias);
if (!$filter instanceof FilterInterface) {
$givenType = is_object($filter) ? get_class($filter) : gettype($filter);
$message = 'Retrieved filter "%s" is not instanceof "Assetic\\Filter\\FilterInterface", but type was given %s';
$message = sprintf($message, $alias, $givenType);
throw new \InvalidArgumentException($message);
}
$this->set($alias, $filter);
return $filter;
}