@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | if(!file_exists(CONTROLADOR_DIR.$controlador.'.php') || !class_exists(CONTROLADOR_NAMESPACE.$controlador)) |
46 | 46 | { |
47 | - return $this->controladorPorDefectoExiste(); |
|
47 | + return $this->controladorPorDefectoExiste(); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $controlador; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | if(!file_exists(CONTROLADOR_DIR.CONTROLADOR_POR_DEFECTO.'.php') || !class_exists(CONTROLADOR_NAMESPACE.CONTROLADOR_POR_DEFECTO)) |
56 | 56 | { |
57 | - throw new Exception("El controlador por defecto no existe"); |
|
57 | + throw new Exception("El controlador por defecto no existe"); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return CONTROLADOR_POR_DEFECTO; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | //controlador esta declarado |
31 | 31 | private function controladorDeclarado(array $url) |
32 | 32 | { |
33 | - if(!isset($url[0])) |
|
33 | + if (!isset($url[0])) |
|
34 | 34 | { |
35 | 35 | return CONTROLADOR_POR_DEFECTO; |
36 | 36 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | private function controladorExiste(string $controlador): string |
44 | 44 | { |
45 | - if(!file_exists(CONTROLADOR_DIR.$controlador.'.php') || !class_exists(CONTROLADOR_NAMESPACE.$controlador)) |
|
45 | + if (!file_exists(CONTROLADOR_DIR.$controlador.'.php') || !class_exists(CONTROLADOR_NAMESPACE.$controlador)) |
|
46 | 46 | { |
47 | 47 | return $this->controladorPorDefectoExiste(); |
48 | 48 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | private function controladorPorDefectoExiste(): string |
54 | 54 | { |
55 | - if(!file_exists(CONTROLADOR_DIR.CONTROLADOR_POR_DEFECTO.'.php') || !class_exists(CONTROLADOR_NAMESPACE.CONTROLADOR_POR_DEFECTO)) |
|
55 | + if (!file_exists(CONTROLADOR_DIR.CONTROLADOR_POR_DEFECTO.'.php') || !class_exists(CONTROLADOR_NAMESPACE.CONTROLADOR_POR_DEFECTO)) |
|
56 | 56 | { |
57 | 57 | throw new Exception("El controlador por defecto no existe"); |
58 | 58 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | private function elMetodoEstaDefinido(array $array): string |
44 | 44 | { |
45 | - if(!isset($array[1])) |
|
45 | + if (!isset($array[1])) |
|
46 | 46 | { |
47 | 47 | return METODO_POR_DEFECTO; |
48 | 48 | } |
@@ -19,9 +19,9 @@ |
||
19 | 19 | { |
20 | 20 | unset($this->_url[0]); |
21 | 21 | |
22 | - if(isset($this->_url[1])) |
|
22 | + if (isset($this->_url[1])) |
|
23 | 23 | { |
24 | - if($this->_metodo->metodo() == $this->_url[1]) |
|
24 | + if ($this->_metodo->metodo() == $this->_url[1]) |
|
25 | 25 | { |
26 | 26 | unset($this->_url[1]); |
27 | 27 | } |
@@ -9,8 +9,7 @@ |
||
9 | 9 | private $_metodo; |
10 | 10 | private $_parametros; |
11 | 11 | |
12 | - public function __construct |
|
13 | - ( |
|
12 | + public function __construct( |
|
14 | 13 | Controlador $Controlador, |
15 | 14 | Metodo $Metodo, |
16 | 15 | Parametros $Parametros |
@@ -7,8 +7,7 @@ |
||
7 | 7 | |
8 | 8 | interface PeticionInterface |
9 | 9 | { |
10 | - public function __construct |
|
11 | - ( |
|
10 | + public function __construct( |
|
12 | 11 | Controlador $Controlador, |
13 | 12 | Metodo $Metodo, |
14 | 13 | Parametros $Parametros |
@@ -18,7 +18,7 @@ |
||
18 | 18 | private function setEnlace(array $array): array |
19 | 19 | { |
20 | 20 | |
21 | - if(!isset($array['url'])) |
|
21 | + if (!isset($array['url'])) |
|
22 | 22 | { |
23 | 23 | return []; |
24 | 24 | } |
@@ -1,20 +1,20 @@ |
||
1 | 1 | <?php |
2 | 2 | declare(strict_types=1); |
3 | -require_once __DIR__ . '/vendor/autoload.php'; |
|
3 | +require_once __DIR__.'/vendor/autoload.php'; |
|
4 | 4 | |
5 | 5 | use src\Factory; |
6 | 6 | |
7 | -define('CONTROLADOR_DIR',__DIR__.'\\controladores\\'); |
|
7 | +define('CONTROLADOR_DIR', __DIR__.'\\controladores\\'); |
|
8 | 8 | |
9 | -define('CONTROLADOR_POR_DEFECTO','Controlador'); |
|
9 | +define('CONTROLADOR_POR_DEFECTO', 'Controlador'); |
|
10 | 10 | |
11 | 11 | define('CONTROLADOR_NAMESPACE', 'controladores\\'); |
12 | 12 | |
13 | -define('METODO_POR_DEFECTO','index'); |
|
13 | +define('METODO_POR_DEFECTO', 'index'); |
|
14 | 14 | |
15 | 15 | $factory = new Factory(); |
16 | 16 | |
17 | -$peticion = $factory->crear('src\CrearPeticion',array( |
|
17 | +$peticion = $factory->crear('src\CrearPeticion', array( |
|
18 | 18 | 'url' => $_REQUEST |
19 | 19 | )); |
20 | 20 |