Skip to content

Commit

Permalink
Change how the app launches
Browse files Browse the repository at this point in the history
- No longer call `run()` from index.php instead when Willow.php is instatiated it launches automatically.
  • Loading branch information
RyanNerd committed Jun 13, 2021
1 parent c45e8aa commit 44ab1ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
16 changes: 1 addition & 15 deletions app/Willow.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@
*/
class Willow
{
/**
* @var App
*/
private App $app;

/**
* Willow constructor.
*
* @param ContainerInterface $container Dependency Injection container object
*/
public function __construct(ContainerInterface $container) {
Expand Down Expand Up @@ -70,14 +64,6 @@ function (Request $request, Response $response) {
// Add ResponseBody as a Request attribute
$v1->add(ResponseBodyFactory::class);

// Save state
$this->app = $app;
}

/**
* App is launched from here to allow unit testing.
*/
final public function run(): void {
$this->app->run();
$app->run();
}
}
2 changes: 1 addition & 1 deletion public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@
}

// Launch the app
(new Willow($container))->run();
(new Willow($container));

0 comments on commit 44ab1ee

Please sign in to comment.