1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
5
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
6
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
7
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
8
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
9
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
10
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
11
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
12
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
13
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
14
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
15
|
|
|
* |
16
|
|
|
* This software consists of voluntary contributions made by many individuals |
17
|
|
|
* and is licensed under the MIT license. For more information, see |
18
|
|
|
* @category |
19
|
|
|
* @package sistema/nucleo |
20
|
|
|
* @copyright Copyright (c) 2006 - 2014 webcol.net (http://www.webcol.net/calima) |
21
|
|
|
* @license https://github.com/webcol/Calima/blob/master/LICENSE MIT |
22
|
|
|
* @version ##BETA 1.0##, ##2014 - 2015## |
23
|
|
|
* <http://www.calimaframework.com>. |
24
|
|
|
*/ |
25
|
|
|
|
26
|
|
|
namespace Sistema\Nucleo; |
27
|
|
|
|
28
|
|
|
class CFSolicitud |
29
|
|
|
{ |
30
|
|
|
private $_controlador; |
31
|
|
|
private $_metodo; |
32
|
|
|
private $_argumentos; |
33
|
|
|
|
34
|
|
|
public function __construct() { |
|
|
|
|
35
|
|
|
if(isset($_GET['url'])){ |
36
|
|
|
$url = filter_input(INPUT_GET, 'url', FILTER_SANITIZE_URL); |
37
|
|
|
$url = explode('/', $url); |
38
|
|
|
$url = array_filter($url); |
39
|
|
|
|
40
|
|
|
//$this->_controlador = strtolower(array_shift($url)); |
41
|
|
|
//$this->_metodo = strtolower(array_shift($url)); |
42
|
|
|
//$this->_argumentos = $url; |
43
|
|
|
|
44
|
|
|
$this->setControlador(strtolower(array_shift($url))); |
45
|
|
|
$this->setMetodo(strtolower(array_shift($url))); |
46
|
|
|
$this->setArgumentos($url); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
if(!$this->getControlador()){ |
50
|
|
|
$this->setControlador(CONTROLADOR_INICIAL); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
if(!$this->getMetodo()){ |
54
|
|
|
$this->setMetodo('index'); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
if(!isset($this->getArgumentos())){ |
58
|
|
|
$this->setArgumentos(array()); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function getControlador() |
63
|
|
|
{ |
64
|
|
|
return $this->_controlador; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function getMetodo() |
68
|
|
|
{ |
69
|
|
|
return $this->_metodo; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function getArgumentos() |
73
|
|
|
{ |
74
|
|
|
return $this->_argumentos; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public function setControlador($controlador) |
78
|
|
|
{ |
79
|
|
|
return $this->_controlador=$controlador; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function setMetodo($metodo) |
83
|
|
|
{ |
84
|
|
|
return $this->_metodo=$metodo; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function setArgumentos($argumento) |
88
|
|
|
{ |
89
|
|
|
return $this->_argumentos=$argumento; |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: