| @@ 76-93 (lines=18) @@ | ||
| 73 | * |
|
| 74 | * @return void |
|
| 75 | */ |
|
| 76 | protected function configureEach() { |
|
| 77 | foreach ($this->providers as $class => &$data) { |
|
| 78 | if ( ! array_contains(array_get($data, 'tags'), ProviderTag::CONFIGURED)) { |
|
| 79 | $this->create(); |
|
| 80 | ||
| 81 | array_add($data, 'tags', ProviderTag::CONFIGURED); |
|
| 82 | $instance = array_get($data, 'instance'); |
|
| 83 | ||
| 84 | if (method_exists($instance, 'configure')) { |
|
| 85 | $this->getProviderInvoker() |
|
| 86 | ->configure($instance, $this->getSharedArguments()); |
|
| 87 | } |
|
| 88 | ||
| 89 | $this->configureEach(); |
|
| 90 | break; |
|
| 91 | } |
|
| 92 | } |
|
| 93 | } |
|
| 94 | ||
| 95 | /** |
|
| 96 | * Initialize all providers. |
|
| @@ 109-126 (lines=18) @@ | ||
| 106 | * |
|
| 107 | * @return void |
|
| 108 | */ |
|
| 109 | protected function initializeEach() { |
|
| 110 | foreach ($this->providers as $class => &$data) { |
|
| 111 | if ( ! array_contains(array_get($data, 'tags'), ProviderTag::INITIALIZED)) { |
|
| 112 | $this->configure(); |
|
| 113 | ||
| 114 | array_add($data, 'tags', ProviderTag::INITIALIZED); |
|
| 115 | $instance = array_get($data, 'instance'); |
|
| 116 | ||
| 117 | if (method_exists($instance, 'initialize')) { |
|
| 118 | $this->getProviderInvoker() |
|
| 119 | ->initialize($instance, $this->getSharedArguments()); |
|
| 120 | } |
|
| 121 | ||
| 122 | $this->initializeEach(); |
|
| 123 | break; |
|
| 124 | } |
|
| 125 | } |
|
| 126 | } |
|
| 127 | ||
| 128 | /** |
|
| 129 | * Boot all providers. |
|
| @@ 142-159 (lines=18) @@ | ||
| 139 | * |
|
| 140 | * @return void |
|
| 141 | */ |
|
| 142 | protected function bootEach() { |
|
| 143 | foreach ($this->providers as $class => &$data) { |
|
| 144 | if ( ! array_contains(array_get($data, 'tags'), ProviderTag::BOOTED)) { |
|
| 145 | $this->initialize(); |
|
| 146 | ||
| 147 | array_add($data, 'tags', ProviderTag::BOOTED); |
|
| 148 | $instance = array_get($data, 'instance'); |
|
| 149 | ||
| 150 | if (method_exists($instance, 'boot')) { |
|
| 151 | $this->getProviderInvoker() |
|
| 152 | ->boot($instance, $this->getSharedArguments()); |
|
| 153 | } |
|
| 154 | ||
| 155 | $this->bootEach(); |
|
| 156 | break; |
|
| 157 | } |
|
| 158 | } |
|
| 159 | } |
|
| 160 | ||
| 161 | /** |
|
| 162 | * Shutdown all providers. |
|
| @@ 177-194 (lines=18) @@ | ||
| 174 | /** |
|
| 175 | * Shutdown all providers. |
|
| 176 | */ |
|
| 177 | protected function shutdownEach() { |
|
| 178 | foreach ($this->providers as $class => &$data) { |
|
| 179 | if ( ! array_contains(array_get($data, 'tags'), ProviderTag::SHUTDOWN)) { |
|
| 180 | $this->boot(); |
|
| 181 | ||
| 182 | array_add($data, 'tags', ProviderTag::SHUTDOWN); |
|
| 183 | $instance = array_get($data, 'instance'); |
|
| 184 | ||
| 185 | if (method_exists($instance, 'shutdown')) { |
|
| 186 | $this->getProviderInvoker() |
|
| 187 | ->boot($instance, $this->getSharedArguments()); |
|
| 188 | } |
|
| 189 | ||
| 190 | $this->shutdownEach(); |
|
| 191 | break; |
|
| 192 | } |
|
| 193 | } |
|
| 194 | } |
|
| 195 | ||
| 196 | /** |
|
| 197 | * @param string $provider |
|