Skip to content

Commit

Permalink
Rename bootstrap to bootstrapWith and make it take an array of bo…
Browse files Browse the repository at this point in the history
…otstrapper classes
  • Loading branch information
bakerkretzmar committed Nov 11, 2022
1 parent 603169f commit 87412ef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion jigsaw
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require __DIR__ . '/vendor/autoload.php';

$app = new TightenCo\Jigsaw\Container;

$app->bootstrap();
$app->bootstrapWith([]);

$application = new Symfony\Component\Console\Application('Jigsaw', '1.4.0');
$application->add($app[TightenCo\Jigsaw\Console\InitCommand::class]);
Expand Down
17 changes: 10 additions & 7 deletions src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,19 @@ public function __construct()
$this->registerCoreAliases();
}

public function bootstrap(): void
public function bootstrapWith(array $bootstrappers): void
{
if (! $this->bootstrapped) {
$this->bootstrapped = true;
$this->bootstrapped = true;

$this->loadEnvironmentVariables();
$this->loadConfiguration();
$this->registerConfiguredProviders();
$this->boot();
$this->loadEnvironmentVariables();
$this->loadConfiguration();

foreach ($bootstrappers as $bootstrapper) {
$this->make($bootstrapper)->bootstrap($this);
}

$this->registerConfiguredProviders();
$this->boot();
}

public function path(string ...$path): string
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function setUp(): void
parent::setUp();

$this->app = new Container;
$this->app->bootstrap();
$this->app->bootstrapWith([]);

$this->app->buildPath = [
'source' => $this->sourcePath,
Expand Down

0 comments on commit 87412ef

Please sign in to comment.