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


PHP Container::bound方法代码示例

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


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

示例1: setupContainer

 /**
  * Setup the IoC container instance.
  *
  * @param  \Illuminate\Container\Container|null  $container
  * @return void
  */
 protected function setupContainer($container)
 {
     $this->container = $container ?: new Container();
     if (!$this->container->bound('config')) {
         $this->container->instance('config', new Fluent());
     }
 }
开发者ID:GeorgeBroadley,项目名称:caffeine-vendor,代码行数:13,代码来源:CapsuleManagerTrait.php

示例2: callWithinStack

 /**
  * Call the given controller instance method.
  *
  * @param  \Illuminate\Routing\Controller  $instance
  * @param  \Illuminate\Routing\Route  $route
  * @param  \Illuminate\Http\Request  $request
  * @param  string  $method
  * @return mixed
  */
 protected function callWithinStack($instance, $route, $request, $method)
 {
     $middleware = $this->getMiddleware($instance, $method);
     $shouldSkipMiddleware = $this->container->bound('middleware.disable') && $this->container->make('middleware.disable') === true;
     return (new Pipeline($this->container))->send($request)->through($shouldSkipMiddleware ? [] : $middleware)->then(function ($request) use($instance, $route, $method) {
         return $this->router->prepareResponse($request, $this->call($instance, $route, $method));
     });
 }
开发者ID:musefind,项目名称:framework,代码行数:17,代码来源:ControllerDispatcher.php

示例3: getAdapter

 /**
  * @param string $name
  * @param Router $router
  * @return mixed
  */
 public function getAdapter($name, Router $router)
 {
     $alias = static::CONTAINER_ADAPTER_PREFIX . $name;
     $this->validateAdapter($name);
     if (false === $this->container->bound($alias)) {
         $this->bindAdapter($name);
     }
     return $this->container->make($alias, [$router]);
 }
开发者ID:bogdananton,项目名称:multi-routing,代码行数:14,代码来源:AdapterService.php

示例4: ensureIlluminateBase

 /**
  * Ensure the base event and file bindings are present. Required for binding anything else.
  *
  * @param  Container  $app
  * @return void
  */
 public function ensureIlluminateBase(Container $app = null)
 {
     if (!$app->bound('events')) {
         $app->singleton('events', $this->illuminateClasses['events']);
         $app['events']->fire('booting');
     }
     if (!$app->bound('files')) {
         $app->bindIf('files', $this->illuminateClasses['files']);
     }
 }
开发者ID:caffeinated,项目名称:beverage,代码行数:16,代码来源:BindIlluminate.php

示例5: it_should_not_affect_parent_container

 /**
  * @test
  */
 public function it_should_not_affect_parent_container()
 {
     $this->parent->instance('a', 1);
     $this->local->instance('a', 2);
     $this->local->instance('b', 3);
     $this->assertTrue($this->parent->bound('a'));
     $this->assertEquals(1, $this->parent->make('a'));
     $this->assertFalse($this->parent->bound('b'));
     $this->assertEquals(2, $this->local->make('a'));
     $this->assertEquals(3, $this->local->make('b'));
 }
开发者ID:e1stuff,项目名称:layered-laravel-container,代码行数:14,代码来源:LayeredContainerTest.php

示例6: storeCache

 /**
  * Store contents in the cache.
  *
  * @param string $content The content to store
  *
  * @return bool
  */
 public function storeCache($content)
 {
     if (!$content) {
         return false;
     }
     // Log caching
     if ($this->app->bound('log')) {
         $this->app['log']->info('Caching page ' . $this->hash);
     }
     // Add page to cached pages
     $cached = array_merge($this->getCachedPages(), [$this->hash]);
     $this->app['flatten.storage']->set('cached', $cached);
     return $this->app['cache']->put($this->hash, $this->formatContent($content), $this->getLifetime());
 }
开发者ID:gilacost,项目名称:flatten,代码行数:21,代码来源:CacheHandler.php

示例7: storeCache

 /**
  * Store contents in the cache
  *
  * @param string $content The content to store
  *
  * @return boolean
  */
 public function storeCache($content)
 {
     if (!$content) {
         return false;
     }
     // Log caching
     if ($this->app->bound('log')) {
         $this->app['log']->info('Caching page ' . $this->hash);
     }
     // Add page to cached pages
     $cached = array_merge($this->getCachedPages(), array($this->hash));
     $this->app['flatten.storage']->set('cached', $cached);
     // Add timestamp to cache
     $content .= PHP_EOL . '<!-- cached on ' . date('Y-m-d H:i:s') . ' -->';
     return $this->app['cache']->put($this->hash, $content, $this->getLifetime());
 }
开发者ID:bberlijn,项目名称:flatten,代码行数:23,代码来源:CacheHandler.php

示例8: get

 /**
  * Resolve the given type from the container.
  *
  * @param string $abstract
  * @param array  $parameters
  *
  * @throws NotFoundException
  * @return mixed
  */
 public function get($abstract, array $parameters = [])
 {
     if (!$this->delegate->bound($abstract)) {
         throw NotFoundException::notBound($abstract);
     }
     return $this->delegate->make($abstract, $parameters);
 }
开发者ID:Mosaic,项目名称:Mosaic,代码行数:16,代码来源:Container.php

示例9: findRouteMethod

 /**
  * Find the method of a route by its _uses or name
  *
  * @param  string $name
  *
  * @return string
  */
 protected function findRouteMethod($name)
 {
     if (!$this->app->bound('router')) {
         return;
     }
     // Get string by name
     if (!Str::contains($name, '@')) {
         $routes = $this->app['router']->getRoutes();
         $route = method_exists($routes, 'getByName') ? $routes->getByName($name) : $routes->get($name);
         // Get string by uses
     } else {
         foreach ($this->app['router']->getRoutes() as $route) {
             $routeUses = method_exists($route, 'getOption') ? $route->getOption('_uses') : array_get($route->getAction(), 'controller');
             if ($action = $routeUses) {
                 if ($action == $name) {
                     break;
                 }
             }
         }
     }
     // Get method
     $methods = method_exists($route, 'getMethods') ? $route->getMethods() : $route->methods();
     $method = array_get($methods, 0);
     return $method;
 }
开发者ID:aleguisf,项目名称:fvdev1,代码行数:32,代码来源:Form.php

示例10: runRouteWithinStack

 /**
  * Run the given route within a Stack "onion" instance.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @param  \Illuminate\Http\Request  $request
  * @return mixed
  */
 protected function runRouteWithinStack(Route $route, Request $request)
 {
     $shouldSkipMiddleware = $this->container->bound('middleware.disable') && $this->container->make('middleware.disable') === true;
     $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route);
     return (new Pipeline($this->container))->send($request)->through($middleware)->then(function ($request) use($route) {
         return $this->prepareResponse($request, $route->run($request));
     });
 }
开发者ID:samlev,项目名称:framework,代码行数:15,代码来源:Router.php

示例11: resolveController

 /**
  * Resolve a controller from the container.
  *
  * @param string $class
  *
  * @return \Illuminate\Routing\Controller
  */
 protected function resolveController($class)
 {
     $controller = $this->container->make($class);
     if (!$this->container->bound($class)) {
         $this->container->instance($class, $controller);
     }
     return $controller;
 }
开发者ID:jacobDaeHyung,项目名称:api,代码行数:15,代码来源:ControllerReviser.php

示例12: resource

 /**
  * Register a resource controller.
  *
  * @param string $name
  * @param string $controller
  * @param array  $options
  *
  * @return void
  */
 public function resource($name, $controller, array $options = [])
 {
     if ($this->container->bound(ResourceRegistrar::class)) {
         $registrar = $this->container->make(ResourceRegistrar::class);
     } else {
         $registrar = new ResourceRegistrar($this);
     }
     $registrar->register($name, $controller, $options);
 }
开发者ID:dingo,项目名称:api,代码行数:18,代码来源:Router.php

示例13: resource

 /**
  * Register a resource controller.
  *
  * @param string $name
  * @param string $controller
  * @param array  $options
  *
  * @return void
  */
 public function resource($name, $controller, array $options = [])
 {
     if ($this->container->bound('Dingo\\Api\\Routing\\ResourceRegistrar')) {
         $registrar = $this->container->make('Dingo\\Api\\Routing\\ResourceRegistrar');
     } else {
         $registrar = new ResourceRegistrar($this);
     }
     $registrar->register($name, $controller, $options);
 }
开发者ID:jrean,项目名称:api,代码行数:18,代码来源:Router.php

示例14: resource

 /**
  * Route a resource to a controller.
  *
  * @param  string  $name
  * @param  string  $controller
  * @param  array   $options
  * @return void
  */
 public function resource($name, $controller, array $options = array())
 {
     if ($this->container && $this->container->bound('Illuminate\\Routing\\ResourceRegistrar')) {
         $registrar = $this->container->make('Illuminate\\Routing\\ResourceRegistrar');
     } else {
         $registrar = new ResourceRegistrar($this);
     }
     $registrar->register($name, $controller, $options);
 }
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:17,代码来源:Router.php

示例15: make

 /**
  * Resolve the given type from the container.
  *
  * @param  string $abstract
  * @param  array $parameters
  * @return mixed
  */
 public function make($abstract, array $parameters = [])
 {
     if (parent::bound($abstract)) {
         return parent::make($abstract, $parameters);
     } elseif ($this->parentContainer->bound($abstract)) {
         return $this->parentContainer->make($abstract, $parameters);
     } else {
         return parent::make($abstract, $parameters);
     }
 }
开发者ID:e1stuff,项目名称:layered-laravel-container,代码行数:17,代码来源:LayeredContainer.php


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