当前位置: 首页>>代码示例>>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;未经允许,请勿转载。