mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
Development
- Isolated Http classes from router. - Removed getInstance from Request object - current router request should now be obtained through SimpleRouter::request(). - Fixed broken test cases. - Added test for regular expression match. - Updated documentation to reflect changes. - Added more helper examples to documentation. - Added helpers to demo-project. - Optimisations.
This commit is contained in:
@@ -5,28 +5,15 @@ use Pecee\Http\Input\Input;
|
||||
|
||||
class Request {
|
||||
|
||||
protected static $instance;
|
||||
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
* Return new instance
|
||||
* @return static
|
||||
*/
|
||||
public static function getInstance() {
|
||||
if(self::$instance === null) {
|
||||
self::$instance = new static();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
$this->data = array();
|
||||
$this->host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : array();
|
||||
$this->uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : array();
|
||||
$this->method = (isset($_POST['_method'])) ? strtolower($_POST['_method']) : (isset($_SERVER['REQUEST_METHOD']) ? strtolower($_SERVER['REQUEST_METHOD']) : array());
|
||||
$this->headers = $this->getAllHeaders();
|
||||
$this->input = new Input();
|
||||
$this->input = new Input($this);
|
||||
}
|
||||
|
||||
protected function getAllHeaders() {
|
||||
|
||||
Reference in New Issue
Block a user