Kdyby\Translation\DI\TranslationExtension::validateResource PHP Метод

validateResource() защищенный Метод

protected validateResource ( string $format, string $file, string $locale, string $domain )
$format string
$file string
$locale string
$domain string
    protected function validateResource($format, $file, $locale, $domain)
    {
        $builder = $this->getContainerBuilder();
        if (!isset($this->loaders[$format])) {
            return;
        }
        try {
            $def = $builder->getDefinition($this->loaders[$format]);
            $refl = Reflection\ClassType::from($def->getEntity() ?: $def->getClass());
            if (($method = $refl->getConstructor()) && $method->getNumberOfRequiredParameters() > 1) {
                return;
            }
            $loader = $refl->newInstance();
            if (!$loader instanceof LoaderInterface) {
                return;
            }
        } catch (\ReflectionException $e) {
            return;
        }
        try {
            $loader->load($file, $locale, $domain);
        } catch (\Exception $e) {
            throw new InvalidResourceException("Resource {$file} is not valid and cannot be loaded.", 0, $e);
        }
    }