-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
56 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace XHGui; | ||
|
||
use Pimple\Container; | ||
use Slim\Slim as App; | ||
use XHGui\Saver\SaverInterface; | ||
|
||
class Application extends Container | ||
{ | ||
/** @var bool */ | ||
private $booted = false; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
$this->register(new ServiceProvider\ServiceProvider()); | ||
$this->register(new ServiceProvider\ConfigProvider()); | ||
$this->register(new ServiceProvider\PdoStorageProvider()); | ||
$this->register(new ServiceProvider\MongoStorageProvider()); | ||
$this->register(new ServiceProvider\SlimProvider()); | ||
} | ||
|
||
public function run(): void | ||
{ | ||
$this->boot()->getSlim()->run(); | ||
} | ||
|
||
public function boot(): self | ||
{ | ||
if (!$this->booted) { | ||
$this->register(new ServiceProvider\RouteProvider()); | ||
$this->booted = true; | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
public function getSlim(): App | ||
{ | ||
return $this['app']; | ||
} | ||
|
||
public function getSaver(): SaverInterface | ||
{ | ||
return $this['saver']; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
<?php | ||
|
||
use Slim\Slim as App; | ||
use XHGui\ServiceContainer; | ||
use XHGui\Application; | ||
|
||
require dirname(__DIR__) . '/vendor/autoload.php'; | ||
|
||
$di = ServiceContainer::instance(); | ||
/** @var App $app */ | ||
$app = $di['app']; | ||
$app = new Application(); | ||
$app->run(); |