Scalr\DependencyInjection\Container::getInstance PHP Метод

getInstance() публичный статический Метод

Gets singleton instance of the Container
public static getInstance ( ) : Container
Результат Container
    public static function getInstance()
    {
        if (is_null(self::$instance)) {
            self::$instance = new Container();
        }
        return self::$instance;
    }

Usage Example

Пример #1
0
 /**
  * Gets config value
  *
  * @param  string $name An option name
  * @return mixed  Returns configuration value for the specified key
  */
 public static function config($name)
 {
     //This is only working with yaml config.
     //If you get error here looks like "Call to a member function get() on a non-object",
     //you probably have not migrated your config.ini to config.yml.
     //Please run php app/bin/upgrade_20130624_migrate_config.php
     return Container::getInstance()->config->get($name);
 }