updated controller/view factories; renamed PanaceaPageController to PanaceaDefaultController
This commit is contained in:
		
							parent
							
								
									14cfcb9610
								
							
						
					
					
						commit
						1e413db8c9
					
				| @ -24,7 +24,7 @@ | ||||
| 		$file = ''; | ||||
| 		switch ($className) { | ||||
| 			case 'PanaceaControllerFactory': | ||||
| 			case 'PanaceaPageController': | ||||
| 			case 'PanaceaDefaultController': | ||||
| 			case 'PanaceaViewFactory': | ||||
| 				$file = "$path/lib/$className.php"; | ||||
| 				break; | ||||
|  | ||||
| @ -58,19 +58,27 @@ | ||||
| 		 * @return PanaceaPageController | ||||
| 		 */ | ||||
| 		public function getController(array $uriFragments) { | ||||
| 			if (count($uriFragments) < 2) { | ||||
| 				throw new InvalidTypeException(1, 'array with at least two elements', $uriFragments); | ||||
| 			if (empty($uriFragments)) { | ||||
| 				throw new InvalidTypeException(1, 'non-empty array', $uriFragments); | ||||
| 			} | ||||
| 			 | ||||
| 			$section = ''; | ||||
| 			$page    = $uriFragments[0]; | ||||
| 			 | ||||
| 			if (isset($uriFragments[1])) { | ||||
| 				$section = $uriFragments[0]; | ||||
| 				$section = ucfirst($uriFragments[0]); | ||||
| 				$page    = $uriFragments[1]; | ||||
| 			} | ||||
| 			if (empty($section)) { | ||||
| 				$section = 'Default'; | ||||
| 			} | ||||
| 			if (empty($page)) { | ||||
| 				$page = 'home'; | ||||
| 			} | ||||
| 			 | ||||
| 			return new PanaceaPageController($uriFragments[0]); | ||||
| 			$controllerName = 'Panacea' . $section . 'Controller'; | ||||
| 			 | ||||
| 			return new $controllerName($page); | ||||
| 		} | ||||
| 		 | ||||
| 	} | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| <?php | ||||
| 
 | ||||
| 	/** | ||||
| 	 * PanaceaPageController | ||||
| 	 * PanaceaDefaultController | ||||
| 	 * | ||||
| 	 * @package Panacea | ||||
| 	 * @author  Tommy Montgomery | ||||
| @ -12,16 +12,16 @@ | ||||
| 	require_once 'NowhereConcave/bootstrap.php'; | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Panacea page controller | ||||
| 	 * Panacea controller | ||||
| 	 * | ||||
| 	 * @package Panacea | ||||
| 	 * @author  Tommy Montgomery | ||||
| 	 * @since   2008-10-05 | ||||
| 	 */ | ||||
| 	class PanaceaPageController extends Controller { | ||||
| 	class PanaceaDefaultController extends Controller { | ||||
| 		 | ||||
| 		/** | ||||
| 		 * Creates a new {@link Controller} | ||||
| 		 * Creates a new {@link PanaceaDefaultController} | ||||
| 		 * | ||||
| 		 * @author Tommy Montgomery | ||||
| 		 * @since  2008-10-05 | ||||
|  | ||||
| @ -61,10 +61,6 @@ | ||||
| 				throw new InvalidTypeException(1, 'string', $page); | ||||
| 			} | ||||
| 			 | ||||
| 			if (empty($page)) { | ||||
| 				$page = 'home'; | ||||
| 			} | ||||
| 			 | ||||
| 			$viewName = 'Panacea' . ucfirst($page) . 'View'; | ||||
| 			 | ||||
| 			try { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user