Возвращает содержимое шаблона

@param string $name    имя файла шаблона
@param string $prefix  опциональный префикс (путь относительно корня шаблонов)

@throws RuntimeException

@return string

@since 3.01
18776
public function getContents($name, $prefix = '')
    {
        $path = $this->rootDir . '/' . $this->getFilename($name, $prefix);

        if (!is_file($path))
        {
            throw new RuntimeException('Template not exists: ' . $path);
        }

        $contents = file_get_contents($path);

        return $contents;
    }
1184934
public static function factory($prefix, $name = null)
    {
        $calledClass = get_called_class();

        /** @var \PhalconRest\Api\ApiCollection $collection */
        $collection = new $calledClass($prefix);

        if ($name) {
            $collection->name($name);
        }

        return $collection;
    }
1282839
public function getNamedRoute(string $name): Route
	{
		if(!isset($this->namedRoutes[$name]))
		{
			throw new RuntimeException(vsprintf('No route named [ %s ] has been defined.', [$name]));
		}

		return $this->namedRoutes[$name];
	}
1016196
public function &get($name)
    {
        if (!array_key_exists($name, $this->properties)) {
            throw new RuntimeException(sprintf(
                "Attempt to access property '%s' of class '%s' failed. Property does not exist.",
                $name,
                $this->calledClassName()
            ));
        }

        return $this->properties[$name];
    }
816188
public static function getInstance($name, array $args = [])
    {
        $psc = PropertySetConfig::getConfig();
        $class = $psc->getClassName($name);

        if (null === $class || !class_exists($class)) {
            return null;
        }

        $config = $psc->getArgs($name);

        try {
            $r = new ReflectionClass($class);
            $ps = $r->newInstance();

            if (!$ps instanceof PropertySetInterface) {
                $errMsg = sprintf(
                    'Объект должен реализовывать интерфейс %s',
                    PropertySetInterface::class
                );
                throw new RuntimeException($errMsg);
            }

            $ps->init($config, $args);

            return $ps;
        } catch (\Exception $e) {
            $errMsg = sprintf(
                'Ошибка при создание сервиса  %s',
                $name
            );
            throw new RuntimeException($errMsg);
        }
    }
514225
public function get($name)
    {
        if (isset($this->instances[$name])) {
            return $this->instances[$name];
        }
        if (! isset($this->registry[$name])) {
            $exceptionClass = static::NOT_FOUND_EXCEPTION;
            throw new $exceptionClass(
                sprintf(static::NOT_FOUND_MESSAGE, $name)
            );
        }
        try {
            $this->instances[$name] = $this->build($this->registry[$name], $name);
        } catch (Exception $e) {
            throw new RuntimeException(
                sprintf(static::BUILD_FAILURE_MESSAGE, $name),
                null,
                $e
            );
        }

        return $this->instances[$name];
    }
20858
public function setContents($contents, $name, $prefix = '')
    {
        $path = $this->rootDir . '/' . $this->getFilename($name, $prefix);

        if (!is_file($path))
        {
            throw new RuntimeException('Template not exists: ' . $path);
        }

        @file_put_contents($path, $contents);
    }
547562
public function cleanName($name)
    {
        $response = $this->query($this->prepareUri('clean/name'), [$name]);
        $result = $this->populate(new Name(), $response);
        if (!$result instanceof Name) {
            throw new RuntimeException('Unexpected populate result: ' . get_class($result). '. Expected: ' . Name::class);
        }

        return $result;
    }
533327
private function findRouteByName($name)
    {
        if (null === $route = $this->routes->get($name)) {
            throw new \RuntimeException(sprintf('Route "%s" not found.', $name));
        }

        return $route;
    }
1335504
public function get($name, array $vars = [])
	{
		$name = BBCode::normalizeName($name);
		$node = $this->xpath->query('//bbcode[@name="' . $name . '"]')->item(0);
		if (!($node instanceof DOMElement))
		{
			throw new RuntimeException("Could not find '" . $name . "' in repository");
		}

		// Clone the node so we don't end up modifying the node in the repository
		$node = $node->cloneNode(true);

		// Replace all the <var> descendants if applicable
		$this->replaceVars($node, $vars);

		// Now we can parse the BBCode usage and prepare the template.
		// Grab the content of the <usage> element then use BBCodeMonkey to parse it
		$usage    = $this->xpath->evaluate('string(usage)', $node);
		$template = $this->xpath->evaluate('string(template)', $node);
		$config   = $this->bbcodeMonkey->create($usage, $template);

		// Set the optional tag name
		if ($node->hasAttribute('tagName'))
		{
			$config['bbcode']->tagName = $node->getAttribute('tagName');
		}

		// Set the rules
		$this->addRules($node, $config['tag']);

		return $config;
	}
442929
protected function buildClass($name)
    {
        $className = $this->formatClassName($name);

        if (!class_exists($className)) {
            throw new RuntimeException('Enum '.$className.' is not exists');
        }

        $enum = new $className();
        if (!$enum instanceof Enumable) {
            throw new RuntimeException('Enum '.$className.' is not instance of '.Enumable::class);
        }

        return $enum;
    }
1329458
public function format($name, array $data) {
        if (!isset($this->_compiled[$name])) {
            throw new RuntimeException("Cannot find template named '$name'.");
        }
        list($template, $placeholders) = $this->_compiled[$name];
        // If there is a {{attrs.xxxx}} block in $template, remove the xxxx attribute
        // from $data['attrs'] and add its content to $data['attrs.class'].
        if (isset($data['attrs'])) {
            foreach ($placeholders as $placeholder) {
                if (substr($placeholder, 0, 6) == 'attrs.'
                    && preg_match('#'.substr($placeholder, 6).'="([^"]*)"#',
                                  $data['attrs'], $matches) > 0) {
                    $data['attrs'] = preg_replace('#'.substr($placeholder, 6).'="[^"]*"#',
                                                  '', $data['attrs']);
                    $data[$placeholder] = trim($matches[1]);
                    if ($data[$placeholder]) {
                        $data[$placeholder] = ' '.$data[$placeholder];
                    }
                }
            }
            $data['attrs'] = trim($data['attrs']);
            if ($data['attrs']) {
                $data['attrs'] = ' '.$data['attrs'];
            }
        }
        return parent::format($name, $data);
    }
431124
public static function SC($name)
    {
        // name consists of a single letter
        if (!preg_match("/^[A-Z]+$/i", $name)) {
            throw new \RuntimeException("invalid column name '$name'");
        }

        // solve longer names recursively
        if (preg_match("/^([A-Z])([A-Z]+)$/i", $name, $matches)) {
            return pow(26, strlen($matches[2])) * (self::SC($matches[1]) + 1) + self::SC($matches[2]);
        }

        return ord(strtoupper($name)) - 64 - 1;
    }
385931
public function getClientByName(string $name): Client
    {
        if (!isset($this->clientsConfig[$name])) {
            throw new RuntimeException(sprintf('Contentful client with "%s" name does not exist.', $name));
        }

        return $this->clientsConfig[$name]['service'];
    }
1239131
public function getValue(string $name)
	{
		if(array_key_exists($name, $this->columns))
		{
			// It's a database column

			return $this->getColumnValue($name);
		}
		elseif(array_key_exists($name, $this->related))
		{
			// The column is a cached or eagerly loaded relation

			return $this->related[$name];
		}
		elseif($this->isRelation($name))
		{
			// The column is a relation. Lazy load the record(s) and cache them

			return $this->related[$name] = $this->$name()->getRelated();
		}

		// All options have been exhausted so we'll throw an exception

		throw new RuntimeException(vsprintf('Unknown column or relation [ %s ].', [$name]));
	}
528355
public function get($name) {
         $this->open();
         $name  =   $this->options['prefix'].$name;
         $s     =   'F' . pack('N', strlen($name)) . $name;
         fwrite($this->handler, $s);

         for ($data = ''; !feof($this->handler);) {
             $data .= fread($this->handler, 4096);
         }
        N('cache_read',1);
         $this->close();
         return $data === '' ? '' : unserialize($data);
     }
1284832
protected function getFilterService($name)
    {
        if (!isset($this->filters[$name])) {
            throw new \RuntimeException('The filter "%s" does not exist.');
        }

        return $this->container->get($this->filters[$name]);
    }