Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
2 / 2 |
| AController | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
2 / 2 |
| __construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| start | |
100.00% |
1 / 1 |
1 | ||||||
| <?php | |
| namespace Tools; | |
| // TODO RestController | |
| // TODO cliController | |
| /** | |
| * Controller abstract class | |
| **/ | |
| abstract class AController | |
| { | |
| /** | |
| * @var array $params | |
| * Contains route parameter | |
| * ex: /product/:id will contains { | |
| * 0 => product | |
| * 1 => [ID] | |
| * ':id' => [ID] | |
| **/ | |
| protected $params; | |
| /** | |
| * @param \Tools\Context $context | |
| * @param array $params | |
| * @throws \Exception\Error404 if parameters does not correspond | |
| * On 404 error, router will try to find another route | |
| * Initialize structure | |
| **/ | |
| public function __construct($context, $params) | |
| { | |
| $this->params = $params; | |
| } | |
| /** | |
| * Fullfill Controller's request | |
| **/ | |
| public abstract function start(); | |
| } | |