Controller.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * Controller
  4. *
  5. * Basic outline for standard system controllers.
  6. *
  7. * @package MicroMVC
  8. * @author David Pennington
  9. * @copyright (c) 2011 MicroMVC Framework
  10. * @license http://micromvc.com/license
  11. ********************************** 80 Columns *********************************
  12. */
  13. namespace Micro;
  14. abstract class Controller
  15. {
  16. // URL path segment matched to route here
  17. public $route = NULL;
  18. // The dispatch object (Can be used to load other Controllers)
  19. public $dispatch = NULL;
  20. /**
  21. * Set error handling and start session
  22. */
  23. public function __construct($route, \Micro\Dispatch $dispatch)
  24. {
  25. $this->route = $route;
  26. $this->dispatch = $dispatch;
  27. }
  28. /**
  29. * Called before the controller method is run
  30. *
  31. * @param string $method name that will be run
  32. */
  33. public function initialize($method) {}
  34. /* HTTP Request Methods
  35. abstract public function run(); // Default for all non-defined request methods
  36. abstract public function get();
  37. abstract public function post();
  38. abstract public function put();
  39. abstract public function delete();
  40. abstract public function options();
  41. abstract public function head();
  42. */
  43. /**
  44. * Called after the controller method is run to send the response
  45. */
  46. public function send() {}
  47. }
  48. // End