@function ImmutableCoreController

instantiate a new controller

@param {object} args

@returns {ImmutableCoreController}

@throws {Error}
353503
function ImmutableCoreController (args) {
    // get copy of original args
    this.args = _.cloneDeep(args)
    // create module and set options
    this.initModule(args)
    // create default paths for model if passed
    this.initModel(args)
    // create paths from arguments
    this.initPaths(args)
    // sort controllers
    this.orderControllers()
}
450957
function update (controller, args) {
    // get model from controller
    var model = controller.model
    // get current instance loaded in before
    var instance = args[model.name+'Orig']
    // get model data from input
    var data = args[model.name]
    //  build update args
    var updateArgs = args.meta ? _.clone(data) : {data: data}
    // set force flag based on input
    if (args.force) {
        updateArgs.force = true
    }
    // set the merge flag to false unless explicitly set true
    if (!args.merge) {
        updateArgs.merge = false
    }
    // do update
    return instance.updateMeta(updateArgs)
    // redirect on success
    .then(instance => {
        // if in json mode return instance data
        if (args.json) {
            return instance
        }
        // otherwise redirect to instance page
        else {
            // use redirect from input or redirect to new instance
            var url = args.redirect || '../'+instance.id
            // redirect
            httpRedirect(url)
        }
    })
    // catch errors
    .catch(error => {
        // if error is redirect throw it
        if (error.code === 302) {
            throw error
        }
        // for version conflict errors return the current instance with the
        // error data and throw a 409 http error
        if (instance.isConflictError(error)) {
            // get current instance
            return instance.current()
            // throw 409 conflic error with current instance data
            .then(current => {
                // if in json mode return error with data
                if (args.json) {
                    httpError(409, undefined, current)
                }
                // otherwise redirect to current instance
                else {
                    httpRedirect('../'+current.id+'?error=conflict')
                }
            })
        }
        // if in json mode or there is no form return 400 error
        if (args.json || !controller.form) {
            httpError(400, undefined, _.pick(error, ['data', 'message']))
        }
        // create new form instance with input and error data
        var form = controller.form.newInstance({
            action: './update',
            input: data,
            error: error,
        })
        // javascript for page
        var js = []
        // if form uses ckeditor add js
        if (form.ckeditor) {
            js.push({
                crossorigin: 'anonymous',
                //integrity: 'sha256-TTtB6JD2qVpmE4ydlMyYH52d7OSMq5FQh2f0ECHR0Bw=',
                src: '//cdn.jsdelivr.net/ckeditor/4.3.1/ckeditor.js',
            })
        }
        // return form
        return {
            form: form,
            js: js,
        }
    })
}
148006
function BreakpointController(options) {
  if (!(this instanceof BreakpointController)) {
    return new BreakpointController(options);
  }

  Emitter.mixin(this);

  var breakpointStream = BreakpointStream.create(options.breakpoints, {
    throttleMs: options.throttleMs,
    debounceMs: options.debounceMs
  });

  var activeBreakpoints = {};

  var self = this;
  Stream.onValue(breakpointStream, function(e) {
    activeBreakpoints[e[0]] = e[1];

    var namedState = e[1] ? 'enter' : 'exit';
    self.trigger('breakpoint', [e[0], namedState]);
    self.trigger('breakpoint:' + e[0], [e[0], namedState]);
  });

  this.getActiveBreakpoints = function getActiveBreakpoints() {
    var isActive = Util.compose(Util.isTrue, Util.get(activeBreakpoints));
    return Util.select(isActive, Util.objectKeys(activeBreakpoints));
  };
}
952486
function () {
      warning(deprecated, recommand);
      
      let args = [];
      for (var i = 0, len = argsString.length; i < len; i++) {
        args.push($injector.get(argsString[i]));
      }
      
      let instance = Object.create(controller.prototype || null);
      angular.merge(instance,this);
      controller.apply(instance,args);
      
      return instance;
    }
673763
function (args) {
  var _interface;
  if (false === (this instanceof Application)) throw new Error('new operator required');
  args = args || {};
  if (!args.attributes) {
    args.attributes = [];
  }
  args.attributes.push(new Attribute({name: 'name', type: 'String(20)'}));
  args.attributes.push(new Attribute({name: 'brand', type: 'String'}));
  if (args.interface) {
    this.setInterface(args.interface);
    delete args.interface;
  }
  Model.call(this, args);
  this.modelType = "Application";
  this.set('name', 'newApp');
  this.set('brand', 'NEW APP');
}
389350
public T newInstance(Object... args)
    {
        try
        {
            return type.cast(factoryMethod.invoke(null, args));
        }
        catch (IllegalAccessException e)
        {
            throw ExceptionImposter.imposterize( e );
        }
        catch (InvocationTargetException e)
        {
            throw ExceptionImposter.imposterize( e.getCause() );
        }
    }
530478
function(arg) {
    this.isCptComponent = true;
    this.ctlConstuctor=arg.ctlConstuctor;

    if (this.template) {
      // this component is associated to a template
      this.createPathObservers();
      this.createCommentBoundaries("cpt");
      this.createChildNodeInstances();

      // $init child components
      this.initChildComponents();
      this.ctlWrapper.refresh(); // first refresh
    } else if (arg.cptattelement) {
      // this component is an attribute of another component
      var cw=cptwrapper.createCptWrapper(this.ctlConstuctor, this.getCptArguments());
      this.ctlWrapper=cw;
      this.controller=cw.cpt;
      if (cw.cpt.tagName) {
          log.error(this+" 'tagName' is a reserved keyword and cannot be used in component controllers");
      }
      cw.cpt.tagName=this.tagName;
      // NB the controller $init has not been called yet - this will be done once the parent component has initialized
    }
  }
1024493
function ImmutableCoreModelSelect (args) {
    // create select object to store state of select
    var select = {}
    // model query will be performed on
    select.model = args.model
    // current context of query
    select.context
    // data associated with context
    select.contextData = {}
    // true if next property access should be column name
    select.expectColumn = false
    // all properties
    select.history = []
    // query to be performed
    select.query = {
        session: args.session,
    }
    // create proxy to map property accesses to query builder commands
    select.proxy = new Proxy({}, {
        // proxy handler with get function that passes select object
        // along with the requested property to the actual handler
        get: function (target, property) {
            return getProxy(select, property)
        }
    })
    // return proxy
    return select.proxy
}
1009099
function ImmutableCoreModelCacheQuerySelect (args) {
    // store args
    this.cache = args.cache
    this.query = args.query
    // init properties
    this.cached = null
    this.selectCacheKey = this.cacheKey()
}
1251430
public T newInstance(Object... args) {
                try {
                        con.setAccessible(true);
                        return con.newInstance(args);
                } catch (Exception e) {
                        throw $(e);
                }
        }
554965
function _Platform_initialize(
    flagDecoder,
    args,
    init,
    update,
    subscriptions,
    stepperBuilder
  ) {
    var result = A2(
      _Json_run,
      flagDecoder,
      _Json_wrap(args ? args["flags"] : undefined)
    );
    elm$core$Result$isOk(result) ||
      _Debug_crash(2 /**/, _Json_errorToString(result.a) /**/);
    var managers = {};
    result = init(result.a);
    var model = result.a;
    var stepper = stepperBuilder(sendToApp, model);
    var ports = _Platform_setupEffects(managers, sendToApp);

    function sendToApp(msg, viewMetadata) {
      result = A2(update, msg, model);
      stepper((model = result.a), viewMetadata);
      _Platform_dispatchEffects(managers, result.b, subscriptions(model));
    }

    _Platform_dispatchEffects(managers, result.b, subscriptions(model));

    return ports ? { ports: ports } : {};
  }
649690
public function triggerController(string $controller, ...$args)
    {
        //extract the class and method
        list($class, $method) = explode('@', $controller, 2);

        //if the class exists
        if (class_exists($class)) {
            //instantiate it
            $instance = new $class();

            //does the method exist ?
            if (method_exists($instance, $method)) {
                call_user_func_array([$instance, $method], $args);
            }
        }

        return $this;
    }
224235
function validateArgs (validateArgs) {
    // set default if value passed
    if (defined(validateArgs)) {
        immutable.defaultValidateArgs = validateArgs ? true : false
        // return immutable
        return ImmutableCore
    }
    // return default value
    return immutable.defaultValidateArgs
}
1300885
function createActionArgs (args, action, state, isAsync) {
  var stateMethods = getStateMutatorsAndAccessors(state, action, isAsync);
  return [ args, stateMethods ];
}
663495
private function createController(): void
    {
        $aFields  = $this->getArguments();
        $aCreated = [];

        try {

            $aControllers = array_filter(
                array_map(function ($sController) {
                    return implode('/', array_map('ucfirst', explode('/', ucfirst(trim($sController)))));
                }, explode(',', $aFields['CONTROLLER_NAME']))
            );
            $aMethods     = array_filter(
                array_map(function ($sMethod) {
                    return lcfirst(trim($sMethod));
                }, explode(',', $aFields['METHODS']))
            );

            sort($aControllers);

            foreach ($aControllers as $sController) {

                $aControllerBits = explode('/', $sController);
                $aControllerBits = array_map('ucfirst', $aControllerBits);

                if (count($aControllerBits) > 2) {
                    throw new ConsoleException('Controllers cannot be deeper than one directory');
                }

                $aFields['MODULE_NAME']     = getFromArray(0, $aControllerBits);
                $aFields['CONTROLLER_NAME'] = getFromArray(1, $aControllerBits, $aFields['MODULE_NAME']);
                $this->oOutput->write('Creating controller <comment>' . $sController . '</comment>... ');


                if (count($aControllerBits) == 2) {
                    //  A path has been specified, splice in the correct folder structure
                    $aLastControllerBits = array_splice($aControllerBits, -1, 1);
                    $aControllerBits     = array_merge(
                        array_map('lcfirst', $aControllerBits),
                        ['controllers'],
                        array_map('ucfirst', $aLastControllerBits)
                    );
                } else {
                    //  The controller should be in a folder called itself
                    $aControllerBits = array_merge(
                        array_map('lcfirst', $aControllerBits),
                        ['controllers'],
                        array_map('ucfirst', $aControllerBits)
                    );
                }

                $aViewBits = $aControllerBits;
                array_splice($aViewBits, -2, 1, ['views']);

                $sControllerPath     = self::CONTROLLER_PATH . implode('/', array_slice($aControllerBits, 0, -1)) . '/';
                $sViewPath           = self::CONTROLLER_PATH . implode('/', array_slice($aViewBits, 0, -1)) . '/';
                $sControllerFilename = end($aControllerBits) . '.php';
                $sClassName          = ucfirst(underscoreToCamelcase(end($aControllerBits)));

                $aFields['CONTROLLER_PATH']     = $sControllerPath;
                $aFields['CONTROLLER_FILENAME'] = $sControllerFilename;
                $aFields['CONTROLLER_CLASS']    = $sClassName;
                $aFields['VIEW_PATH']           = $sViewPath;

                //  Check if the controller already exists
                if (file_exists($sControllerPath . $sControllerFilename)) {
                    throw new ConsoleException(
                        'Controller "' . $sController . '" already exists at "' . $sControllerPath . $sControllerFilename . '"'
                    );
                }

                //  Generate methods
                if ($aFields['MODULE_NAME'] === $aFields['CONTROLLER_NAME']) {
                    $sViewPathPrefix = '';
                    $sViewPrefix     = lcfirst($aFields['CONTROLLER_NAME']) . '/';
                } else {
                    $sViewPathPrefix = $aFields['CONTROLLER_NAME'] . '/';
                    $sViewPrefix     = lcfirst($aFields['MODULE_NAME']) . '/' . $aFields['CONTROLLER_NAME'] . '/';
                }

                $aMethodStrings = [];
                $aViews         = [];
                reset($aMethods);
                foreach ($aMethods as $sMethod) {

                    $aViews[]         = $sViewPathPrefix . $sMethod;
                    $aMethodStrings[] = '';
                    $aMethodStrings[] = $this->getResource(
                        'template/controller_method.php',
                        [
                            'METHOD_NAME' => $sMethod,
                            'METHOD_VIEW' => $sViewPrefix . $sMethod,
                        ]
                    );
                    $aMethodStrings[] = '';
                    $aMethodStrings[] = '// --------------------------------------------------------------------------';
                }

                //  Remove the first item (blank string) and the last two (separators)
                $aMethodStrings = array_slice($aMethodStrings, 1, -2);

                //  Add leading tabs
                array_walk(
                    $aMethodStrings,
                    function (&$sLine) {
                        $sLine = trim($sLine);
                        if (!empty($sLine)) {
                            $aLines = explode("\n", $sLine);
                            foreach ($aLines as &$sSingleLine) {
                                $sSingleLine = $this->tabs(1) . $sSingleLine;
                            }
                            $sLine = implode("\n", $aLines);
                        }
                    }
                );

                $aFields['METHODS'] = implode("\n", $aMethodStrings);

                //  Ensure the path exists
                $this->createPath($aFields['CONTROLLER_PATH']);

                //  Create the controller and write to it
                $this->createFile(
                    $aFields['CONTROLLER_PATH'] . $aFields['CONTROLLER_FILENAME'],
                    $this->getResource('template/controller.php', $aFields)
                );
                $aCreated[] = $aFields['CONTROLLER_PATH'] . $aFields['CONTROLLER_FILENAME'];
                $this->oOutput->writeln('<info>done!</info>');

                //  Create the views
                $this->oOutput->write('Creating views for controller <comment>' . $sController . '</comment>... ');
                $this->createPath($aFields['VIEW_PATH']);

                foreach ($aViews as $sView) {
                    $sViewPath    = $aFields['VIEW_PATH'] . $sView . '.php';
                    $sViewSubPath = dirname($sView);
                    if ($sViewSubPath !== '.') {
                        $this->createPath($aFields['VIEW_PATH'] . $sViewSubPath);
                    }
                    $this->createFile(
                        $sViewPath,
                        $this->getResource(
                            'template/view.php',
                            [
                                'VIEW' => preg_replace('#^' . NAILS_APP_PATH . '#', '', $sViewPath),
                            ]
                        )
                    );
                    $aCreated[] = $sView;

                }
                $this->oOutput->writeln('<info>done!</info>');
            }

        } catch (ConsoleException $e) {
            $this->oOutput->writeln('<error>failed!</error>');
            //  Clean up created models
            if (!empty($aCreated)) {
                $this->oOutput->writeln('<error>Cleaning up - removing newly created files</error>');
                foreach ($aCreated as $sPath) {
                    @unlink($sPath);
                }
            }
            throw new ConsoleException($e->getMessage());
        }
    }
827293
@SuppressWarnings("unchecked")
	public T create(Object[] args)
	{
		for(int i=0, n=args.length; i<n; i++)
		{
			if(arguments[i] instanceof FactoryDefinition.InjectedArgument)
			{
				args[i] = arguments[i].getValue(null);
			}
		}

		try
		{
			return (T) raw.newInstance(args);
		}
		catch(IllegalArgumentException e)
		{
			throw new SerializationException("Unable to create; " + e.getMessage(), e);
		}
		catch(InstantiationException e)
		{
			throw new SerializationException("Unable to create; " + e.getMessage(), e);
		}
		catch(IllegalAccessException e)
		{
			throw new SerializationException("Unable to create; " + e.getMessage(), e);
		}
		catch(InvocationTargetException e)
		{
			throw new SerializationException("Unable to create; " + e.getCause().getMessage(), e.getCause());
		}
	}
588769
function cloneArgs(args) {
    var newArgs = {};
    for(var key in args){
      if (key && args.hasOwnProperty(key)) {
        newArgs[key] = args[key];
      }
    }
    newArgs.isCacheableValue = args.isCacheableValue && args.isCacheableValue.bind(newArgs);
    return newArgs;
  }