AController.php 696 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Tools;
  3. // TODO RestController
  4. // TODO cliController
  5. /**
  6. * Controller abstract class
  7. **/
  8. abstract class AController
  9. {
  10. /**
  11. * @var array $params
  12. * Contains route parameter
  13. * ex: /product/:id will contains {
  14. * 0 => product
  15. * 1 => [ID]
  16. * ':id' => [ID]
  17. **/
  18. protected $params;
  19. /**
  20. * @param \Tools\Context $context
  21. * @param array $params
  22. * @throws \Exception\Error404 if parameters does not correspond
  23. * On 404 error, router will try to find another route
  24. * Initialize structure
  25. **/
  26. public function __construct($context, $params)
  27. {
  28. $this->params = $params;
  29. }
  30. /**
  31. * Fullfill Controller's request
  32. **/
  33. public abstract function start();
  34. }