router = $router; $this->config = $config; $this->rac = $rac; } public function getDash() { $dashboard = new DashBoard($this->config['title']); foreach ($this->config['zones'] as $zone) { $obj_zone = call_user_func_array( array( new \ReflectionClass($zone['model_class']), 'newInstance' ), $zone['model_params'] ); foreach ($zone['items'] as $item) { $obj_item = call_user_func_array( array( new \ReflectionClass($item['model_class']), 'newInstance' ), $item['model_params'] ); $method = $item['test_is_granted'] ? 'addItemIfGranted' : 'addChild'; $this->rac->setRoute(!empty($item['route_uri']) ? $item['route_uri'] : $this->router->generate($item['route_name'], $item['route_params'])); call_user_func(array($obj_zone, $method), $obj_item, $this->rac); } $dashboard->addZone($obj_zone); } return $dashboard; } }