AController.php 650 B

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