当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::bound方法代码示例

本文整理汇总了PHP中Illuminate\Foundation\Application::bound方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::bound方法的具体用法?PHP Application::bound怎么用?PHP Application::bound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Foundation\Application的用法示例。


在下文中一共展示了Application::bound方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepare

 /**
  * Prepare the database connection instance.
  *
  * @param  \Illuminate\Database\Connection  $connection
  * @return \Illuminate\Database\Connection
  */
 protected function prepare(Connection $connection)
 {
     $connection->setFetchMode($this->app['config']['database.fetch']);
     if ($this->app->bound('events')) {
         $connection->setEventDispatcher($this->app['events']);
     }
     // The database connection can also utilize a cache manager instance when cache
     // functionality is used on queries, which provides an expressive interface
     // to caching both fluent queries and Eloquent queries that are executed.
     $app = $this->app;
     $connection->setCacheManager(function () use($app) {
         return $app['cache'];
     });
     // We will setup a Closure to resolve the paginator instance on the connection
     // since the Paginator isn't used on every request and needs quite a few of
     // our dependencies. It'll be more efficient to lazily resolve instances.
     $connection->setPaginator(function () use($app) {
         return $app['paginator'];
     });
     // Here we'll set a reconnector callback. This reconnector can be any callable
     // so we will set a Closure to reconnect from this manager with the name of
     // the connection, which will allow us to reconnect from the connections.
     $connection->setReconnector(function ($connection) {
         $this->reconnect($connection->getName());
     });
     return $connection;
 }
开发者ID:noikiy,项目名称:laravel-UI,代码行数:33,代码来源:DatabaseManager.php

示例2: testRegister

 public function testRegister()
 {
     $provider = new InlinerServiceProvider($this->app);
     $provider->register();
     $this->assertTrue($this->app->bound('Chromabits\\Illuminated\\Contracts\\Inliner\\StyleInliner'));
     $this->assertInstanceOf('Chromabits\\Illuminated\\Contracts\\Inliner\\StyleInliner', $this->app->make('Chromabits\\Illuminated\\Contracts\\Inliner\\StyleInliner'));
 }
开发者ID:MarkVaughn,项目名称:illuminated,代码行数:7,代码来源:InlinerServiceProviderTest.php

示例3: isResolvable

 /**
  * Determines if passed ReflectionParameter $parameter can be resolved from IoC.
  * If $parameter can be resolved and it's bound in IoC it's bound class/interface name
  * will be returned.
  *
  * @param ReflectionParameter $parameter
  * @param $reflectionKey
  * @param array $params
  * @return bool|string
  */
 protected function isResolvable(ReflectionParameter $parameter, $reflectionKey, $params = array())
 {
     /**
      * check if parameter available from $params with $reflectionKey key
      */
     if (array_key_exists($reflectionKey, $params)) {
         return false;
     }
     /**
      * check if $parameter has type
      */
     preg_match('/\\[\\s\\<\\w+?>\\s([\\w\\\\]+)/s', (string) $parameter, $matches);
     if (count($matches) < 1) {
         return false;
     }
     /**
      * check if $parameter type is not array and can be treated as class/interface
      */
     $canBeCreated = array_key_exists(1, $matches) && !$parameter->isArray() && is_string($matches[1]);
     /**
      * check if $parameter class/interface exists or it's been bound
      */
     $existsOrBound = class_exists($matches[1]) || $this->laraApp->bound($matches[1]);
     return $canBeCreated && $existsOrBound ? $matches[1] : false;
 }
开发者ID:laravel-commode,项目名称:resolver,代码行数:35,代码来源:Resolver.php

示例4: prepare

 /**
  * Prepare the database connection instance.
  *
  * @param  \KageNoNeko\OSM\ConnectionInterface $connection
  *
  * @return \KageNoNeko\OSM\ConnectionInterface
  */
 protected function prepare(ConnectionInterface $connection)
 {
     if ($this->app->bound('events')) {
         $connection->setEventDispatcher($this->app['events']);
     }
     return $connection;
 }
开发者ID:KageNoNeko,项目名称:osm,代码行数:14,代码来源:Manager.php

示例5: rememberSocket

 /**
  * Remember the socket for the given request.
  *
  * @param  \Illuminate\Http\Request|null  $request
  * @return void
  */
 public function rememberSocket($request = null)
 {
     if (!$request && !$this->app->bound('request')) {
         return;
     }
     $request = $request ?: $this->app['request'];
     $this->app['cache']->forever('pusher:socket:' . $request->session()->getId(), $request->socket_id);
 }
开发者ID:themsaid,项目名称:framework,代码行数:14,代码来源:BroadcastManager.php

示例6: socket

 /**
  * Get the socket ID for the given request.
  *
  * @param  \Illuminate\Http\Request|null  $request
  * @return string|null
  */
 public function socket($request = null)
 {
     if (!$request && !$this->app->bound('request')) {
         return;
     }
     $request = $request ?: $this->app['request'];
     if ($request->hasHeader('X-Socket-ID')) {
         return $request->header('X-Socket-ID');
     }
 }
开发者ID:davidhemphill,项目名称:framework,代码行数:16,代码来源:BroadcastManager.php

示例7: enableModule

 /**
  * Load a single module by it's name.
  *
  * @param string $module
  * @throws InvalidSignatureException module does'nt implement the right interface
  * @throws ModuleNotFoundException module does'nt exists
  * @return bool
  */
 protected function enableModule($module)
 {
     $definition = $this->getFullyQualifiedModuleClassName($module) . '\\Module';
     if (!(class_exists($definition) || $this->app->bound($definition))) {
         throw new ModuleNotFoundException("Module {$definition} does'nt exist");
     }
     /** @var ModuleDefinitionContract $module */
     $module = $this->app->make($definition, [$this->app, $module]);
     if (!$module instanceof ModuleDefinitionContract) {
         throw new InvalidSignatureException("Class {$definition} must implements ModuleDefinition interface");
     }
     return $module->bootstrap();
 }
开发者ID:ferrl,项目名称:framework,代码行数:21,代码来源:ModuleLoader.php

示例8: repository

 /**
  * Create a new cache repository with the given implementation.
  *
  * @param  \Illuminate\Contracts\Cache\Store  $store
  * @return \Illuminate\Cache\Repository
  */
 public function repository(Store $store)
 {
     $repository = new Repository($store);
     if ($this->app->bound('Illuminate\\Contracts\\Events\\Dispatcher')) {
         $repository->setEventDispatcher($this->app['Illuminate\\Contracts\\Events\\Dispatcher']);
     }
     return $repository;
 }
开发者ID:davidhemphill,项目名称:framework,代码行数:14,代码来源:CacheManager.php

示例9: __construct

 /**
  * Create a new auth extension.
  *
  * @param \Illuminate\Foundation\Application $app
  */
 public function __construct(Application $app)
 {
     if ($app->bound('debugbar')) {
         $this->debugbar = $app['debugbar'];
     } else {
         $this->debugbar = null;
     }
 }
开发者ID:barryvdh,项目名称:laravel-debugbar,代码行数:13,代码来源:Debug.php

示例10: prepare

 /**
  * Prepare the database connection instance.
  *
  * @param  \Illuminate\Database\Connection  $connection
  * @return \Illuminate\Database\Connection
  */
 protected function prepare(Connection $connection)
 {
     $connection->setFetchMode($this->app['config']['database.fetch']);
     if ($this->app->bound('events')) {
         $connection->setEventDispatcher($this->app['events']);
     }
     // Here we'll set a reconnector callback. This reconnector can be any callable
     // so we will set a Closure to reconnect from this manager with the name of
     // the connection, which will allow us to reconnect from the connections.
     $connection->setReconnector(function ($connection) {
         $this->reconnect($connection->getName());
     });
     return $connection;
 }
开发者ID:hilmysyarif,项目名称:sisfito,代码行数:20,代码来源:DatabaseManager.php

示例11: prepare

 /**
  * Prepare the database connection instance.
  *
  * @param  \LMongo\Connection  $connection
  * @return \LMongo\Connection
  */
 protected function prepare(Connection $connection)
 {
     if ($this->app->bound('events')) {
         $connection->setEventDispatcher($this->app['events']);
     }
     // The database connection can also utilize a cache manager instance when cache
     // functionality is used on queries, which provides an expressive interface
     // to caching both fluent queries and Eloquent queries that are executed.
     $app = $this->app;
     $connection->setCacheManager(function () use($app) {
         return $app['cache'];
     });
     // We will setup a Closure to resolve the paginator instance on the connection
     // since the Paginator isn't sued on every request and needs quite a few of
     // our dependencies. It'll be more efficient to lazily resolve instances.
     $connection->setPaginator(function () use($app) {
         return $app['paginator'];
     });
     return $connection;
 }
开发者ID:navruzm,项目名称:lmongo,代码行数:26,代码来源:DatabaseManager.php

示例12: bound

 /**
  * Determine if the given abstract type has been bound.
  * 
  * (Overriding Container::bound)
  *
  * @param string $abstract
  * @return bool 
  * @static 
  */
 public static function bound($abstract)
 {
     return \Illuminate\Foundation\Application::bound($abstract);
 }
开发者ID:satriashp,项目名称:tour,代码行数:13,代码来源:_ide_helper.php

示例13: modifyResponse

 /**
  * Modify the response and inject the debugbar (or data in headers)
  *
  * @param  \Symfony\Component\HttpFoundation\Request $request
  * @param  \Symfony\Component\HttpFoundation\Response $response
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function modifyResponse(Request $request, Response $response)
 {
     $app = $this->app;
     if ($app->runningInConsole() || !$this->isEnabled() || $this->isDebugbarRequest()) {
         return $response;
     }
     // Show the Http Response Exception in the Debugbar, when available
     if (isset($response->exception)) {
         $this->addThrowable($response->exception);
     }
     if ($this->shouldCollect('config', false)) {
         try {
             $configCollector = new ConfigCollector();
             $configCollector->setData($app['config']->all());
             $this->addCollector($configCollector);
         } catch (\Exception $e) {
             $this->addThrowable(new Exception('Cannot add ConfigCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
         }
     }
     if ($this->app->bound(SessionManager::class)) {
         /** @var \Illuminate\Session\SessionManager $sessionManager */
         $sessionManager = $app->make(SessionManager::class);
         $httpDriver = new SymfonyHttpDriver($sessionManager, $response);
         $this->setHttpDriver($httpDriver);
         if ($this->shouldCollect('session') && !$this->hasCollector('session')) {
             try {
                 $this->addCollector(new SessionCollector($sessionManager));
             } catch (\Exception $e) {
                 $this->addThrowable(new Exception('Cannot add SessionCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
             }
         }
     } else {
         $sessionManager = null;
     }
     if ($this->shouldCollect('symfony_request', true) && !$this->hasCollector('request')) {
         try {
             $this->addCollector(new SymfonyRequestCollector($request, $response, $sessionManager));
         } catch (\Exception $e) {
             $this->addThrowable(new Exception('Cannot add SymfonyRequestCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
         }
     }
     if ($app['config']->get('debugbar.clockwork') && !$this->hasCollector('clockwork')) {
         try {
             $this->addCollector(new ClockworkCollector($request, $response, $sessionManager));
         } catch (\Exception $e) {
             $this->addThrowable(new Exception('Cannot add ClockworkCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
         }
         $this->addClockworkHeaders($response);
     }
     if ($response->isRedirection()) {
         try {
             $this->stackData();
         } catch (\Exception $e) {
             $app['log']->error('Debugbar exception: ' . $e->getMessage());
         }
     } elseif ($this->isJsonRequest($request) && $app['config']->get('debugbar.capture_ajax', true)) {
         try {
             $this->sendDataInHeaders(true);
         } catch (\Exception $e) {
             $app['log']->error('Debugbar exception: ' . $e->getMessage());
         }
     } elseif ($response->headers->has('Content-Type') && strpos($response->headers->get('Content-Type'), 'html') === false || $request->getRequestFormat() !== 'html') {
         try {
             // Just collect + store data, don't inject it.
             $this->collect();
         } catch (\Exception $e) {
             $app['log']->error('Debugbar exception: ' . $e->getMessage());
         }
     } elseif ($app['config']->get('debugbar.inject', true)) {
         try {
             $this->injectDebugbar($response);
         } catch (\Exception $e) {
             $app['log']->error('Debugbar exception: ' . $e->getMessage());
         }
     }
     return $response;
 }
开发者ID:barryvdh,项目名称:laravel-debugbar,代码行数:84,代码来源:LaravelDebugbar.php

示例14: bound

 /**
  * Determine if the given abstract type has been bound.
  *
  * @param string $abstract
  * @return bool 
  * @static 
  */
 public static function bound($abstract)
 {
     //Method inherited from \Illuminate\Container\Container
     return \Illuminate\Foundation\Application::bound($abstract);
 }
开发者ID:jorzhikgit,项目名称:MLM-Nexus,代码行数:12,代码来源:_ide_helper.php


注:本文中的Illuminate\Foundation\Application::bound方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。