feature/bootstrap #2
5
config/application.php
Normal file
5
config/application.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'providers' => []
|
||||
];
|
@ -2,15 +2,21 @@
|
||||
|
||||
namespace Core\Application;
|
||||
|
||||
use Core\Configuration\Configurations;
|
||||
use Illuminate\Container\Container;
|
||||
|
||||
class Application
|
||||
{
|
||||
private Container $container;
|
||||
/** @var Container $container */
|
||||
private $container;
|
||||
|
||||
public function __construct(Container $container)
|
||||
/** @var Configurations */
|
||||
private $configurations;
|
||||
|
||||
public function __construct(Container $container, Configurations $configurations)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->configurations = $configurations;
|
||||
}
|
||||
|
||||
public function run()
|
||||
|
54
core/Configuration/Configurations.php
Normal file
54
core/Configuration/Configurations.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Configuration;
|
||||
|
||||
/**
|
||||
* Class Configurations
|
||||
* @package Core\Configuration
|
||||
* @author Romano Schoonheim https://github.com/romano1996
|
||||
*/
|
||||
class Configurations
|
||||
{
|
||||
private $configurations = [];
|
||||
|
||||
public function __construct(FileSystem $fileSystem)
|
||||
{
|
||||
foreach ($fileSystem->getConfigurationFiles() as $configurationFile) {
|
||||
print_r($configurationFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// private const IGNORED_FILES = [
|
||||
// '.',
|
||||
// '..',
|
||||
// 'config.php',
|
||||
// 'config_sample.php'
|
||||
// ];
|
||||
//
|
||||
//
|
||||
// private $configurations = [];
|
||||
//
|
||||
// public function __construct()
|
||||
// {
|
||||
// foreach (scandir(self::CONFIGURATION_DIRECTORY) as $item) {
|
||||
// if (in_array($item, self::IGNORED_FILES)) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// $filePath = self::CONFIGURATION_DIRECTORY . $item;
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// die();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public function config(string $path): array
|
||||
// {
|
||||
// return $this->configurations;
|
||||
// }
|
||||
}
|
8
core/Configuration/Factories/FileFactory.php
Normal file
8
core/Configuration/Factories/FileFactory.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Configuration\Factories;
|
||||
|
||||
class FileFactory
|
||||
{
|
||||
|
||||
}
|
33
core/Configuration/FileSystem.php
Normal file
33
core/Configuration/FileSystem.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Configuration;
|
||||
|
||||
use Core\Configuration\Factories\FileFactory;
|
||||
use Core\Configuration\Objects\File;
|
||||
|
||||
/**
|
||||
* Class FileSystem
|
||||
* @package Core\Configuration
|
||||
* @author Romano Schoonheim https://github.com/romano1996
|
||||
*/
|
||||
class FileSystem
|
||||
{
|
||||
private const CONFIGURATION_DIRECTORY = __DIR__ . '/../../config/';
|
||||
|
||||
private $fileFactory;
|
||||
|
||||
public function __construct(FileFactory $factory)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return File[]
|
||||
*/
|
||||
public function getConfigurationFiles(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
10
core/Configuration/Objects/File.php
Normal file
10
core/Configuration/Objects/File.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Configuration\Objects;
|
||||
|
||||
class File
|
||||
{
|
||||
protected string $name;
|
||||
|
||||
protected string $mimeType;
|
||||
}
|
@ -5,22 +5,29 @@
|
||||
*/
|
||||
|
||||
use Core\Application\Application;
|
||||
use Core\Configuration\Configurations;
|
||||
use Illuminate\Container\Container;
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
$container = new Container();
|
||||
|
||||
/**
|
||||
* Load providers
|
||||
*/
|
||||
|
||||
|
||||
$container->singleton(
|
||||
Configurations::class,
|
||||
Configurations::class
|
||||
);
|
||||
|
||||
/**
|
||||
* Create application & run
|
||||
*/
|
||||
$application = new Application(
|
||||
$container
|
||||
$container,
|
||||
$container->make(Configurations::class)
|
||||
);
|
||||
$application->run();
|
||||
|
||||
|
||||
/**
|
||||
* Bootstrap v1.0
|
||||
*/
|
||||
require_once __DIR__ . '/../app/Bootstrap.php';
|
||||
|
Loading…
Reference in New Issue
Block a user