function controllerFactory(sName, oControllerImpl, sViewId, bAsync) {
			var oController,
				ControllerClass,
				sOwnerId = _runWithOwner.getCurrentOwnerId();

			if (typeof oControllerImpl === "boolean") {
				oControllerImpl = undefined;
			}

			if (!oControllerImpl) {
				// controller *instantiation*
				if (bAsync) {
					return loadControllerClass(sName, sViewId, bAsync)
						.then(function(ControllerClass) {
							return instantiateController(ControllerClass, sName);
						})
						.then(function(oController) {
							return Controller.applyExtensions(oController, sName, sOwnerId, sViewId, bAsync);
						})
						.then(function(oController) {
							oController._sapui_isExtended = true;
							return oController;
						});
				} else {
					ControllerClass = loadControllerClass(sName, sViewId, bAsync);
					oController = instantiateController(ControllerClass, sName);
					oController = Controller.applyExtensions(oController, sName, sOwnerId, sViewId, bAsync);
					//if controller is created via the factory all extensions are already mixed in
					oController._sapui_isExtended = true;
				}
				return oController;
			} else {
				// controller *definition*
				mRegistry[sName] = oControllerImpl;
				Log.info("For defining controllers use Controller.extend instead");
			}
		}
Old controller factory implementation
@param {string} sName
@param {Object|undefined} oControllerImpl
@param {string|undefined} sViewId
@param {boolean} bAsync
@ui5-transform-hint replace-param bAsync true