Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 2 |
| AController | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
6 | |
0.00% |
0 / 2 |
| __construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 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(); | |
| } | |