{@inheritdoc}
@throws \RuntimeException
332925
public function getConfigTreeBuilder(): TreeBuilder
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root($this->root);

        $rootNode
            ->children()
            ->scalarNode('admin_class')->defaultValue(Admin::class)->end()
            ->scalarNode('action_class')->defaultValue(Action::class)->end()
            ->scalarNode('fallback_template_directory')->defaultNull()->end()
            ->append($this->getAdminConfigTreeBuilder())
            ->end();

        return $treeBuilder;
    }
1076133
public function compile(Compiler $compiler)
    {
        $compiler->addDebugInfo($this);

        $compiler
            ->write('throw new \RuntimeException(')
            ->subcompile($this->getNode('message'))
            ->write(', ')
            ->write($this->getAttribute('code') ?: 500)
            ->write(");\n");
    }
723315
protected function init()
	{
		if (isset($this->theme) === false)
		{
			throw new \RuntimeException('Theme property does not exist.');
		}

		if (empty($this->theme) === false and is_string($this->theme))
		{
			$this->theme = \Theme::instance($this->theme);
		}

		// Sets active theme
		if (empty($this->theme_active) === false and is_string($this->theme_active))
		{
			$this->theme->active($this->theme_active);
		}

		// Initialize template
		$this->template_init();

		$this->theme->set_template($this->template);

		// Makes the theme instance available in all views
		$this->template->set_global('theme', $this->theme, false);
	}
290818
protected function initialize()
    {
        $command = $this->client->createCommand('MULTI');

        $this->client->executeCommand($command, function ($response) {
            if (false === $response) {
                throw new RuntimeException('Could not initialize a MULTI / EXEC transaction');
            }
        });
    }
748825
public function create()
    {
        $entityClass = $this->getEntityName();

        $reflection = new \ReflectionClass($entityClass);

        if ($reflection->isAbstract()) {
            throw RuntimeException::createAbstract($entityClass);
        }

        return new $entityClass();
    }
1151786
protected function execute(InputInterface $input, OutputInterface $output)
    {
        try
        {
            if (method_exists($this, 'start'))
            {
                $this->start();
            }
            else
            {
                throw new \RuntimeException('Command is not set correctly.');
            }
        }
        catch (\Exception $e)
        {
            $this->error($e->getMessage());
        }
    }
1342211
public function setup($configurations = array())
    {
        foreach ($configurations as $key => $value) {
            if (!$this->registry->config->has($key)) {
                throw new \RuntimeException(sprintf('Unknown setup key %s.', $key));
            }
            if ($this->registry->validator->has($key)) {
                $validator = $this->registry->validator->get($key);
                if (!$validator->isValid($value)) {
                    if (count($choices = $validator->getChoices())) {
                        throw new \RuntimeException(sprintf('Invalid value %s for %s, values are %s.', var_export($value, true), $key, implode(', ', $choices)));
                    } else {
                        throw new \RuntimeException(sprintf('Invalid value %s for %s.', var_export($value, true), $key));
                    }
                }
            }
            $this->registry->config->set($key, $value);
        }

        return $this;
    }
662510
public function send()
    {
        $provider = $this->getProvider();
        if (!$provider) {
            throw new \RuntimeException('未设置短信供应商');
        }

        $provider->send($this);

        return $this;
    }
233821
public function render()
    {
        if (!is_readable($this->template) || !is_file($this->template)) {
            throw new \RuntimeException('Cannot read template ' . $this->template);
        }

        ob_start();
        include $this->template;
        return ob_get_clean();
    }
726545
public function init()
    {
        if (!$this->getQuery()) {
            throw new \RuntimeException('Uninitialized QueryBuilder');
        }
        $this->resetIterator();

        if (0 === $this->getPage() || 0 === $this->getMaxPerPage()) {
            $this->setLastPage(0);
            $this->getQuery()->setFirstResult(0);
            $this->getQuery()->setMaxResults(0);
        } else {
            $offset = ($this->getPage() - 1) * $this->getMaxPerPage();
            $this->getQuery()->setFirstResult($offset);

            $maxOffset = $this->getThreshold() > 0
                ? $this->getMaxPerPage() * $this->threshold + 1 : $this->getMaxPerPage() + 1;

            $this->getQuery()->setMaxResults($maxOffset);
            $this->initializeIterator();

            $t = (int) ceil($this->thresholdCount / $this->getMaxPerPage()) + $this->getPage() - 1;
            $this->setLastPage(max(1, $t));
        }
    }
525489
public function run()
    {
        $url = parse_url($_SERVER['REQUEST_URI']);

        $controller = $this->router->find($url['path']);
        if (!$controller instanceof ControllerInterface) {
            throw new \RuntimeException('No valid controller found.');
        }

        $controller->setServer($this);

        $result = $controller->execute();

        $data = json_encode($result);

        if (array_key_exists('callback', $_GET)) {
            $data = $_GET['callback'] . '(' . $data . ')';
        }
        
        return $data;
    }
152362
public function update()
    {
        if (!$this->exists()) {
            throw new \RuntimeException('Cannot update a table that doesn\'t exist!');
        }

        // update table
        foreach ($this->getPendingColumns() as $column) {
            $this->getAdapter()->addColumn($this, $column);
        }

        foreach ($this->getIndexes() as $index) {
            $this->getAdapter()->addIndex($this, $index);
        }

        foreach ($this->getForeignKeys() as $foreignKey) {
            $this->getAdapter()->addForeignKey($this, $foreignKey);
        }

        $this->saveData();
        $this->reset(); // reset pending changes
    }
408570
public function toArray()
    {
        $data = array();

        foreach ($this as $key => $value) {
            if (is_object($value)) {
                if (!is_callable(array($value, 'toArray'))) {
                    throw new RuntimeException('Object does not implement toArray() method on key: ' . $key);
                }
                $data[$key] = $value->toArray();
            } else {
                $data[$key] = $value;
            }
        }

        return $data;
    }
886345
protected function _field($field) {
		if (!isset($this->_config['fieldMap'][$field])) {
			throw new RuntimeException(__d('user_tools', 'Invalid field "%s"!', $field));
		}

		return $this->_config['fieldMap'][$field];
	}
1160653
public function send()
    {
        if (!$this->client) {
            throw new RuntimeException('A client must be set on the request');
        }

        if (null === $this->configuration->url) {
            $this->configuration->url = $this->getUrl()->toString();
        }
        $this->prepare();

        return $this->client->send($this);
    }
1121726
public static function Init()
	{
		if( !is_null(self::$_Instance) )
		{
			throw RuntimeException::EnvironmentFactoryAlreadyInitialized();
		}

		self::$_Instance = new static();

		return self::$_Instance;
	}
76243
protected function execute($command)
    {
        $process = new Process($command, null, null, null, $this->timeout);
        $process->run();

        if (!$process->isSuccessful()) {
            throw new \RuntimeException($process->getErrorOutput());
        }
    }