Loads the given template.

@param string|TemplateReferenceInterface $name A template name or a TemplateReferenceInterface instance

@return Storage A Storage instance

@throws \InvalidArgumentException if the template cannot be found
325658
protected function load($name)
    {
        $template = $this->parser->parse($name);

        $key = $template->getLogicalName();
        if (isset($this->cache[$key])) {
            return $this->cache[$key];
        }

        $storage = $this->loader->load($template);

        if (false === $storage) {
            throw new \InvalidArgumentException(sprintf('The template "%s" does not exist.', $template));
        }

        return $this->cache[$key] = $storage;
    }
1020384
protected function loadCache(string $name)
    {
        $path = $this->cache_path;
        $cache_file = $path . '/' . $name  . '.cache';

        if (file_exists($cache_file))
        {
            if (!is_readable($cache_file))
            {
                self::getLogger()->error("Cannot read cache from {0}", [$cache_file]);
            }
            else
            {
                try
                {
                    $contents = file_get_contents($cache_file);
                    $data = unserialize($contents);
                    if (!is_array($data))
                        $data = [];
                    $this->repository[$name] = $data;
                    $this->repository[$name]['_changed'] = false;
                    $this->checkExpiry($name);
                    return;
                }
                catch (\Throwable $t)
                {
                    self::getLogger()->error("Failure loading cache {0} - removing", [$name]);
                    self::getLogger()->error("Error: {0}", [$t]);
                    if (is_writable($cache_file))
                        unlink($cache_file);
                }
            }
        }
        self::getLogger()->debug("Cache {0} does not exist - creating", [$cache_file]);
        $this->repository[$name] = [];
    }
185743
public function load( $slug, $name = '' )
	{
		if( !empty(( $template = $this->get( $slug, $name )))) {
			DevelopmentFacade::storeTemplatePath( $template );
			load_template( $template, false );
		}
	}
254390
public function load($name)
    {
        $factoryClass = ucfirst($name) . "Phactory";

        if (!class_exists($factoryClass)) {
            throw new \Exception("Unknown factory '$name'");
        }

        return new Factory($name, new $factoryClass);
    }
856861
public static function getPluginByName($name) {

		$db = Database::getInstance();
		$db->setQuery('SELECT * FROM `templates` WHERE name=?');
		$obj = $db->loadObject($name);
		return (is_a($obj, 'stdClass') ? new Template($obj) : NULL);
		
	}
881829
protected function loader($name)
    {
        if (false !== \strpos('.', $name)) {
            throw new Exceptions\Invalid($name);
        }

        if (isset($this->loaders[$name])) {
            return $this->loaders[$name];
        }

        foreach ($this->extensions as $extension) {
            try {
                $path = $this->buildPath($name, $extension);
                $this->loaders[$name] = FileLoader::load($path);

                return $this->loaders[$name];
            } catch (NotFound\Path $argumentException) {
                continue;
            }
        }

        throw new NotFound\Path($this->root . $name);
    }
348381
public function loadFile($url)
    {
        //Locate the template
        $locator = $this->getObject('template.locator.factory')->createLocator($url);

        if (!$file = $locator->locate($url)) {
            throw new InvalidArgumentException(sprintf('The template "%s" cannot be located.', $url));
        }

        //Load the template
        if(!$source = file_get_contents($file)) {
            throw new RuntimeException(sprintf('The template "%s" cannot be loaded.', $file));
        }

        $this->_source = $source;

        return $this;
    }
689601
final public function getTable(string $name): Table
    {
        if (!array_key_exists($name, $this->tables)) {
            throw new InvalidArgumentException('Table '.$name.' not added');
        }

        return $this->tables[$name];
    }
1021894
public function storage($name = null)
	{
		$name = $name ?: $this->getDefaultDriver();

		return $this->stores[$name] = (isset($this->stores[$name]) ? $this->stores[$name] : $this->resolve($name));
	}
598126
public function getCollector($name)
    {
        if (!isset($this->collectors[$name])) {
            throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name));
        }

        return $this->collectors[$name];
    }
1368945
public function get($name)
    {
        if (!isset($this->storages[$name])) {
            throw new InvalidArgumentException("Storage $name not found.");
        }

        return $this->storages[$name];
    }
1142196
public function load($name)
    {
        if (!array_key_exists($name, $this->cached)) {
            foreach (array_reverse($this->paths) as $path) {
                foreach ($this->parsers as $ext => $parser) {
                    $file = "$path/$name.$ext";
                    if (is_file($file)) {
                        $this->cached[$name] = new $parser($file);

                        break 2;
                    }
                }
            }
        }

        if (!isset($this->cached[$name])) {
            $this->cached[$name] = new NativeArray;
        }

        return $this->cached[$name];
    }
770967
protected function loadFile($name)
    {
        $fileName = $this->getFileName($name);

        if ($this->shouldCheckPath() && !file_exists($fileName)) {
            throw new Mustache_Exception_UnknownTemplateException($name);
        }

        return file_get_contents($fileName);
    }
893675
private function getTemplate($name)
    {
        $templates = $this->container->getParameter('sonata.formatter.ckeditor.configuration.templates');

        if (isset($templates[$name])) {
            return $templates[$name];
        }

        return null;
    }
1051048
public function findTemplate($name)
    {
        if ($this->files->exists($name)) {
            return $name;
        }

        $name = $this->normalizeName($name);

        if (isset($this->cache[$name])) {
            return $this->cache[$name];
        }

        try {
            $this->cache[$name] = $this->finder->find($name);
        } catch (InvalidArgumentException $ex) {
            throw new LoaderError($ex->getMessage());
        }

        return $this->cache[$name];
    }
988474
public function getUploadDir($name)
    {
        if (array_key_exists($name, $this->paths)) {
            return $this->paths[$name];
        } else {
            throw new \InvalidArgumentException(sprintf('Upload path "%s" is not defined.', $name));
        }
    }
1030870
public function getFile($name)
    {
        if ($file = $this->resolveFile($name)) {
            return $file;
        } else {
            $components = $this->parseResource($name);
            throw new \RuntimeException(sprintf('Template "%s" not found in directories "%s"', $components['file'], implode('", "', $components['dirs'])));
        }
    }