當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Container::getInstance方法代碼示例

本文整理匯總了PHP中Container::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP Container::getInstance方法的具體用法?PHP Container::getInstance怎麽用?PHP Container::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Container的用法示例。


在下文中一共展示了Container::getInstance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onNotFound

 public function onNotFound(\Event $event)
 {
     $controller = new \Controller(\App::getInstance());
     $page = $controller->twigInit()->render(\Config::get('view::notfound_page'));
     $response = new \Response($page, 404);
     \Container::getInstance()->setResponse($response);
 }
開發者ID:fucongcong,項目名稱:framework,代碼行數:7,代碼來源:NotFoundListener.php

示例2: __construct

 public function __construct($rotate = true, $push = true, $files = 5)
 {
     $this->rotate = $rotate;
     $this->push = $push;
     $this->files = $files;
     $this->container = Container::getInstance();
 }
開發者ID:retailcrm,項目名稱:legacy,代碼行數:7,代碼來源:Logger.php

示例3: getContainer

 /**
  * Gets container instance
  * @return object
  */
 private static function getContainer()
 {
     if (!static::$container) {
         static::$container = Container::getInstance();
     }
     return static::$container;
 }
開發者ID:hungrylab,項目名稱:binocle-framework,代碼行數:11,代碼來源:Facade.php

示例4: app

function app($make = null, $parameters = [])
{
    if (is_null($make)) {
        return Container::getInstance();
    }
    return Container::getInstance()->make($make, $parameters);
}
開發者ID:mwerezi,項目名稱:basepack,代碼行數:7,代碼來源:helpers.php

示例5: writeLog

 public static function writeLog($level, $message, $context, $model)
 {
     $logger = new Logger($model);
     $env = \Container::getInstance()->getEnvironment();
     $logger->pushHandler(new StreamHandler(static::$cache_dir . '/' . $env . '.log', self::$levels[$level]));
     $logger->pushHandler(new FirePHPHandler());
     return $logger->{$level}($message, $context);
 }
開發者ID:PHILIP-2014,項目名稱:Group,代碼行數:8,代碼來源:Log.php

示例6: __construct

 public function __construct()
 {
     $path = \Container::getInstance()->getAppPath();
     require_once $path . 'vendor/hprose/hprose/src/Hprose.php';
     $type = \Config::get('rpc::current_server');
     $server = \Config::get('rpc::server');
     $host = $server[$type]['host'];
     $port = $server[$type]['port'];
     $this->client = new \HproseSwooleClient("{$type}://{$host}:{$port}");
 }
開發者ID:fucongcong,項目名稱:framework,代碼行數:10,代碼來源:RpcService.php

示例7: cache

 /**
  * Get / set the specified cache value.
  *
  * If an array is passed as the key, we will assume you want to set an array of values.
  *
  * @param  array|string $key
  * @param  mixed        $default
  *
  * @return mixed
  */
 function cache($key = null, $default = null)
 {
     if (is_null($key)) {
         return Container::getInstance()->make('cache');
     }
     if (is_array($key)) {
         return Container::getInstance()->make('cache')->put($key);
     }
     return Container::getInstance()->make('cache')->get($key, $default);
 }
開發者ID:nukacode,項目名稱:lumen-base,代碼行數:20,代碼來源:helpers.php

示例8: resolveStatique

 protected static function resolveStatique($name)
 {
     if (is_object($name)) {
         return $name;
     }
     if (isset(static::$resolvedInstance[$name])) {
         return static::$resolvedInstance[$name];
     }
     return static::$resolvedInstance[$name] = Container::getInstance()->make($name);
 }
開發者ID:leon723,項目名稱:chestnut,代碼行數:10,代碼來源:Statique.php

示例9: __construct

 public function __construct($arguments)
 {
     $this->run = isset($arguments['e']) ? trim($arguments['e']) : false;
     $this->uid = isset($arguments['p']) ? trim($arguments['p']) : false;
     $this->ref = isset($arguments['r']) ? trim($arguments['r']) : false;
     $this->mail = isset($arguments['m']) ? trim($arguments['m']) : false;
     $this->history = isset($arguments['h']) ? trim($arguments['h']) : false;
     $this->limit = isset($arguments['l']);
     $this->update = isset($arguments['u']);
     $this->custom = isset($arguments['c']);
     $this->debug = isset($arguments['d']);
     $this->container = Container::getInstance();
     $this->api = new RequestProxy($this->container->settings['api']['url'], $this->container->settings['api']['key']);
     $this->requestHelper = new ApiHelper($this->api);
 }
開發者ID:retailcrm,項目名稱:legacy,代碼行數:15,代碼來源:Command.php

示例10: get

 public static function get($key)
 {
     // app.slack.token
     $parts = explode('.', $key);
     $container = Container::getInstance();
     $base = $container->{'config.' . $parts[0]};
     unset($parts[0]);
     foreach ($parts as $part) {
         if (isset($base[$part])) {
             $base = $base[$part];
         } else {
             return null;
         }
     }
     return $base;
 }
開發者ID:AdrianPop,項目名稱:sense,代碼行數:16,代碼來源:Config.php

示例11: __construct

 public function __construct($mailBox)
 {
     $this->container = Container::getInstance();
     $this->rule = new Rule();
     $this->mailBox = $mailBox;
     if (is_array($this->container->mail)) {
         if (isset($this->container->mail[$mailBox])) {
             $this->mailSettings = explode(',', $this->container->mail[$mailBox]);
         } else {
             CommandHelper::settingsFailure($mailBox);
             exit(1);
         }
     } else {
         CommandHelper::activateNotice('mail');
         exit(1);
     }
 }
開發者ID:retailcrm,項目名稱:legacy,代碼行數:17,代碼來源:Mail.php

示例12: __construct

 public function __construct()
 {
     $this->rule = new Rule();
     $this->logger = new Logger();
     $this->container = Container::getInstance();
 }
開發者ID:retailcrm,項目名稱:legacy,代碼行數:6,代碼來源:Builder.php

示例13: hasBean

 public static function hasBean($beanName)
 {
     return Container::getInstance()->hasBean($beanName);
 }
開發者ID:rousseau-christopher,項目名稱:equinox-core,代碼行數:4,代碼來源:ContainerFactory.php

示例14: __construct

 /**
  * set container instance
  */
 public function __construct()
 {
     $this->container = Container::getInstance();
 }
開發者ID:labzone,項目名稱:injector,代碼行數:7,代碼來源:Extension.php

示例15: __construct

 /**
  * DIContainer constructor.
  * @param array $config
  */
 protected function __construct(array $config)
 {
     $this->config = $this->createFlatConfig($config);
     $this->services['service.di_container'] =& $this;
     $this->services['service.container'] = Container::getInstance($config);
 }
開發者ID:jakulov,項目名稱:container,代碼行數:10,代碼來源:DIContainer.php


注:本文中的Container::getInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。