/** * Return the object of the given type catched from request var * * @param array request the $_REQUEST object. Extract the 'on' param to get the object type * @param array opt option array. See class documentation for valid options * @return a new object of $_REQUEST['on'] type * @access public */ public static function factory(array $request = array(), array $opt = array()) { $name = R3LookupController::getObjectType($request); $fileName = R3_LOOKUP_DIR . 'lkp.' . $name . '.php'; if (!file_exists($fileName)) { throw new Exception('Invalid value for parameter "on": "' . $request['on'] . '"'); } require_once $fileName; $className = R3LookupController::getObjectClassName($request); return new $className($request, $opt); }