Started implementing the Factory.

This will have huge consequences for FuzeWorks.
This commit is contained in:
Abel Hoogeveen 2016-05-24 12:42:14 +02:00
parent 3343c08594
commit 7d3323bfe7
3 changed files with 111 additions and 0 deletions

1
.gitignore vendored
View File

@ -23,3 +23,4 @@ Modules/admin/themes/adminlte2.1/dist/
Modules/admin/themes/adminlte2.1/bootstrap/
doc
nbproject
Application/Cache

View File

@ -151,6 +151,7 @@ class Core
include_once 'Core/System/class.security.php';
include_once 'Core/System/class.input.php';
include_once 'Core/System/class.output.php';
include_once 'Core/System/class.factory.php';
// Load the core classes
new Config();
@ -169,6 +170,7 @@ class Core
new Input();
new Router();
new Output();
new Factory();
self::$loaded = true;
}

View File

@ -40,4 +40,112 @@ namespace FuzeWorks;
class Factory
{
private static $sharedFactoryInstance;
private $instances = array();
public function __construct()
{
$this->instances['Layout'] = new Layout();
self::$sharedFactoryInstance = $this;
}
public function newInstance($className, $namespace = 'FuzeWorks\\')
{
$instanceName = ucfirst($className);
$className = $namespace.$instanceName;
$this->instances[$instanceName] = new $className();
}
public static function getInstance()
{
return clone self::$sharedFactoryInstance;
}
public function getConfig()
{
return new Config();
}
public function getCore()
{
}
public function getDatabase()
{
}
public function getEvents()
{
}
public function getHelpers()
{
}
public function getInput()
{
}
public function getLanguage()
{
}
public function getLayout()
{
return $this->instances['Layout'];
}
public function getLibraries()
{
}
public function getLogger()
{
}
public function getModels()
{
}
public function getModules()
{
}
public function getOutput()
{
}
public function getRouter()
{
}
public function getSecurity()
{
}
public function getUri()
{
}
public function getUtf8()
{
}
}