Blame view

public/vendor/illuminate/support/Traits/CapsuleManagerTrait.php 1.4 KB
86143e36f   Андрей Ларионов   Коммит вторник
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  <?php
  
  namespace Illuminate\Support\Traits;
  
  use Illuminate\Contracts\Container\Container;
  use Illuminate\Support\Fluent;
  
  trait CapsuleManagerTrait
  {
      /**
       * The current globally used instance.
       *
       * @var object
       */
      protected static $instance;
  
      /**
       * The container instance.
       *
       * @var \Illuminate\Contracts\Container\Container
       */
      protected $container;
  
      /**
       * Setup the IoC container instance.
       *
       * @param  \Illuminate\Contracts\Container\Container  $container
       * @return void
       */
      protected function setupContainer(Container $container)
      {
          $this->container = $container;
  
          if (! $this->container->bound('config')) {
              $this->container->instance('config', new Fluent);
          }
      }
  
      /**
       * Make this capsule instance available globally.
       *
       * @return void
       */
      public function setAsGlobal()
      {
          static::$instance = $this;
      }
  
      /**
       * Get the IoC container instance.
       *
       * @return \Illuminate\Contracts\Container\Container
       */
      public function getContainer()
      {
          return $this->container;
      }
  
      /**
       * Set the IoC container instance.
       *
       * @param  \Illuminate\Contracts\Container\Container  $container
       * @return void
       */
      public function setContainer(Container $container)
      {
          $this->container = $container;
      }
  }