Exemplo n.º 1
0
		public static function add($path, $controller, $method)
		{
			if (isset(self::$controller))
				return true;

			// Get URL Variables
			preg_match_all('/\(\:(.+?)\)/', $path, $matches);
			$URLVars = $matches[1];
			
			// Generate URL Parser - '/^\/example\/([^\/]+?)\/$/i'
			$path = preg_replace(self::$search, self::$replace, $path);
			
			if (preg_match($path, self::$url, $values))
			{
				// Path Found Set Vars and Route
				array_shift($values);
				self::$controller = $controller;
				self::$method = $method;
				
				// Add Params to Method Call
				if (!empty($values)) foreach(array_combine($URLVars, $values)
					as $key => $value)
						self::$params[] = $value;
			}
		}