-
Notifications
You must be signed in to change notification settings - Fork 6
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
1 parent
44457c6
commit 65e8445
Showing
8 changed files
with
130 additions
and
34 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,63 @@ | ||
<?php | ||
|
||
namespace livetyping\hermitage\app; | ||
|
||
/** | ||
* Class Sources | ||
* | ||
* @package livetyping\hermitage\app | ||
*/ | ||
final class Sources | ||
{ | ||
/** @var string[] */ | ||
protected $files = []; | ||
|
||
/** | ||
* Sources constructor. | ||
* | ||
* @param array $files | ||
*/ | ||
public function __construct(array $files = []) | ||
{ | ||
$this->files = $this->core(); | ||
foreach ($files as $file) { | ||
$this->add((string)$file); | ||
} | ||
} | ||
|
||
/** | ||
* Adds file containing definitions | ||
* | ||
* @param string $file the name of a file containing definitions | ||
* | ||
* @return $this | ||
*/ | ||
public function add(string $file) | ||
{ | ||
$this->files[] = $file; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Returns the list of files containing definitions | ||
* | ||
* @return array | ||
*/ | ||
public function all(): array | ||
{ | ||
return $this->files; | ||
} | ||
|
||
/** | ||
* @return string[] | ||
*/ | ||
protected function core(): array | ||
{ | ||
return [ | ||
__DIR__ . '/config/settings.php', | ||
__DIR__ . '/config/definitions.php', | ||
__DIR__ . '/config/decorators.php' | ||
]; | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace livetyping\hermitage\bootstrap; | ||
|
||
use Dotenv\Dotenv; | ||
use livetyping\hermitage\app\App; | ||
use livetyping\hermitage\app\Sources; | ||
|
||
/** | ||
* @param \livetyping\hermitage\app\Sources $sources | ||
* | ||
* @return \livetyping\hermitage\app\App | ||
*/ | ||
function app(Sources $sources): App | ||
{ | ||
$app = new App($sources); | ||
require __DIR__ . '/../app/routes.php'; | ||
|
||
return $app; | ||
} | ||
|
||
/** | ||
* @param string $path | ||
*/ | ||
function load_dotenv(string $path) | ||
{ | ||
$path = rtrim($path, '/'); | ||
if (file_exists($path . '/.env')) { | ||
(new Dotenv($path))->load(); | ||
} | ||
} |
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