/** * Create an UploadFile instance * * @param \Zend\Validator\ValidatorPluginManager $validators * @return UploadFile */ public function __invoke($validators) { $services = $validators->getServiceLocator(); $validator = new UploadFile($this->creationOptions); if ($services->has('Request')) { $validator->setRequest($services->get('Request')); } return $validator; }
/** * @param ContainerInterface $container * @param string $requestedName, * @param null|array $options * @return UploadFile */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { if ($container instanceof AbstractPluginManager && !method_exists($container, 'configure')) { $container = $container->getServiceLocator() ?: $container; } $validator = new UploadFile($options); if ($container->has('Request')) { $validator->setRequest($container->get('Request')); } return $validator; }