public static function connectController(ControllerCollection $ctrlsFactory, $controllerArray) { $ctrlAccessPath = $controllerArray['Access'] . ':'; foreach ($controllerArray['Actions'] as $_action) { $route = Annots\Route::buildRoute($ctrlsFactory, $_action['Path'], $controllerArray['Prefix'], $ctrlAccessPath, $_action['Name']); Annots\Method::buildRoute($route, $_action['Method']); Annots\Bind::buildRoute($route, $_action['Bind'], $controllerArray['Prefix'], $_action['Name']); } }
public static function connectController(ControllerCollection $ctrlsFactory, $controllerArray) { $ctrlAccessPath = $controllerArray['Namespace'] . '\\' . $controllerArray['Name'] . '::'; $prefix = $controllerArray['Prefix']; foreach ($controllerArray['Actions'] as $_action) { $method = Annots\Method::forUsage($_action['Method']); $route = $prefix . $_action['Route']; $action = $_action['Name']; $binded = Annots\Bind::forUsage($_action['Bind'], $prefix, $_action['Name']); /** @var Controller $routeFactored */ $routeFactored = $ctrlsFactory->match($route, $ctrlAccessPath . $action)->bind($binded)->method($method); // TODO : proposer le assert en annot //if (strpos($route, '{id}') !== false) // $routeFactored->assert('id', "\d+"); } }