-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConfiguration.php
More file actions
69 lines (51 loc) · 1.72 KB
/
Configuration.php
File metadata and controls
69 lines (51 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
include_once ("Controller/PaginaDeVisualizacionController.php");
include_once ("Controller/PokedexController.php");
include_once ("Controller/PaginaDeCreacionController.php");
include_once("Controller/LoginsController.php");
include_once ("Model/PokemonModel.php");
include_once ("Helper/Router.php");
include_once ("Helper/DataBase.php");
include_once ("Helper/MustachePresenter.php");
include_once ("vendor/mustache/src/Mustache/Autoloader.php");
class Configuration
{
//controller
public static function getPokedexController()
{
return new PokedexController( self::getPokemonModel(),self::getPresenter());
}
public static function getPaginaDeVisualizacionController()
{
return new PaginaDeVisualizacionController( self::getPokemonModel(),self::getPresenter());
}
public static function getPaginaDeCreacionController()
{
return new PaginaDeCreacionController( self::getPokemonModel(),self::getPresenter());
}
public static function getLoginsController()
{
return new LoginsController( self::getPokemonModel(),self::getPresenter());
}
//model
private static function getPokemonModel()
{
return new PokemonModel(self::Database());
}
//Helper
public static function getRouter(){
return new Router();
}
private static function getPresenter()
{
return new MustachePresenter("view/template");
}
private static function getConfig()
{
return parse_ini_file("config/config.ini");
}
public static function Database(){
$config = self::getConfig();
return new Database($config["servername"], $config["username"], $config["database"], $config["password"]);
}
}