/** * Tests */ public function testParams() { $get_array = array('page' => 'Home', 'handler' => 'GET', 'foo' => 'get'); $post_array = array('handler' => 'POST', 'action' => 'Save', 'foo' => 'post'); $this->simulate_cgi_request($get_array, $post_array); $request = new NeechyRequest(); $this->assertEquals('Home', $request->page); $this->assertEquals('post', $request->handler); $this->assertEquals('save', $request->action); $this->assertEquals('post', $request->param('foo')); $this->assertEquals('GET', $request->get('handler')); $this->assertEquals('POST', $request->post('handler')); }
public static function load() { if (!is_null(self::$instance)) { return self::$instance; } else { self::$instance = new NeechyRequest(); return self::$instance; } }
public function serve() { try { NeechySecurity::start_session(); NeechySecurity::prevent_csrf(); $this->request = NeechyRequest::load(); $this->validate_environment(); $handler = $this->load_handler(); $response = $handler->handle(); } catch (NeechyError $e) { $handler = new ErrorHandler($this->request); $response = $handler->handle_error($e); } $response->send_headers(); $response->render(); }
public function __construct($theme = 'bootstrap') { $this->theme_path = $this->load_theme_path($theme); $this->theme_url_path = sprintf('themes/%s/', $theme); $this->request = NeechyRequest::load(); }