Skip to content
This repository has been archived by the owner on Jul 4, 2018. It is now read-only.

Commit

Permalink
Register clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikbjorn authored and fabpot committed Aug 27, 2014
1 parent 0328d90 commit 354b766
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/Silex/Application.php
Expand Up @@ -143,11 +143,7 @@ public function register(ServiceProviderInterface $provider, array $values = arr
{
$this->providers[] = $provider;

$provider->register($this);

foreach ($values as $key => $value) {
$this[$key] = $value;
}
parent::register($provider, $values);

return $this;
}
Expand All @@ -160,17 +156,19 @@ public function register(ServiceProviderInterface $provider, array $values = arr
*/
public function boot()
{
if (!$this->booted) {
$this->booted = true;
if ($this->booted) {
return;
}

foreach ($this->providers as $provider) {
if ($provider instanceof EventListenerProviderInterface) {
$provider->subscribe($this, $this['dispatcher']);
}
$this->booted = true;

foreach ($this->providers as $provider) {
if ($provider instanceof EventListenerProviderInterface) {
$provider->subscribe($this, $this['dispatcher']);
}

if ($provider instanceof BootableProviderInterface) {
$provider->boot($this);
}
if ($provider instanceof BootableProviderInterface) {
$provider->boot($this);
}
}
}
Expand Down

0 comments on commit 354b766

Please sign in to comment.