public function callClassAndMethodWithInputArguments(
        $class,
        $method,
        \Mmf\IO\RequestInterface $request
    ) {
        $params = $this->getFunctionArguments($class, $method);

        $listOfParams = [];
        foreach ($params as $param) {
            $paramValue = $request->input($param['name']);
            if ($paramValue === null && $param['isOptional'] === false) {
                throw new ControllerException('The param ' . $param['name'] . ' is mandatory', 1501);
            } elseif ($paramValue === null && $param['isOptional'] === true) {
                $paramValue = $param['initialValue'];
            }
            $listOfParams[] = $paramValue;
        }
        if (!is_object($class)) {
            $class = new $class();
        }
        $returnOfAction = call_user_func_array(array($class, $method), $listOfParams);
        if ($returnOfAction !== false) {
            return $returnOfAction;
        } else {
            throw new \Mmf\Core\CoreException('FrontController::callClassAndMethodWithInputArguments'
            . ', Is not unable to call the action (' . $method . ') with '
            . 'the parameters(' . print_r($listOfParams, true) . '), the expected name of parameters are'
            . '(' . print_r($params, true) . ')');
        }
    }
public function callClassAndMethodWithInputArguments(
        $class,
        $method,
        \Mmf\IO\RequestInterface $request
    ) {
        $params = $this->getFunctionArguments($class, $method);

        $listOfParams = [];
        foreach ($params as $param) {
            $paramValue = $request->input($param['name']);
            if ($paramValue === null && $param['isOptional'] === false) {
                throw new ControllerException('The param ' . $param['name'] . ' is mandatory', 1501);
            } elseif ($paramValue === null && $param['isOptional'] === true) {
                $paramValue = $param['initialValue'];
            }
            $listOfParams[] = $paramValue;
        }
        if (!is_object($class)) {
            $class = new $class();
        }
        $returnOfAction = call_user_func_array(array($class, $method), $listOfParams);
        if ($returnOfAction !== false) {
            return $returnOfAction;
        } else {
            throw new \Mmf\Core\CoreException('FrontController::callClassAndMethodWithInputArguments'
            . ', Is not unable to call the action (' . $method . ') with '
            . 'the parameters(' . print_r($listOfParams, true) . '), the expected name of parameters are'
            . '(' . print_r($params, true) . ')');
        }
    }
public function callClassAndMethodWithInputArguments ( $ class , $ method , \ Mmf \ IO \ RequestInterface $ request ) { $ params = $ this -> getFunctionArguments ( $ class , $ method ) ; $ listOfParams = [ ] ; foreach ( $ params as $ param ) { $ paramValue = $ request -> input ( $ param [ 'name' ] ) ; if ( $ paramValue === null && $ param [ 'isOptional' ] === false ) { throw new ControllerException ( 'The param ' . $ param [ 'name' ] . ' is mandatory' , 1501 ) ; } elseif ( $ paramValue === null && $ param [ 'isOptional' ] === true ) { $ paramValue = $ param [ 'initialValue' ] ; } $ listOfParams [ ] = $ paramValue ; } if ( ! is_object ( $ class ) ) { $ class = new $ class ( ) ; } $ returnOfAction = call_user_func_array ( array ( $ class , $ method ) , $ listOfParams ) ; if ( $ returnOfAction !== false ) { return $ returnOfAction ; } else { throw new \ Mmf \ Core \ CoreException ( 'FrontController::callClassAndMethodWithInputArguments' . ', Is not unable to call the action (' . $ method . ') with ' . 'the parameters(' . print_r ( $ listOfParams , true ) . '), the expected name of parameters are' . '(' . print_r ( $ params , true ) . ')' ) ; } }
Call a class and a method trying to pass the method recive in the request.
If the request doesn't have the parameters, it is set to false.

@param string | object      $class to call the method
@param string               $method to be call
@param \RequestInterface $request

@return mixed

@throws \ControllerException
@throws \CoreException
Call a class and a method trying to pass the method recive in the request . If the request doesn t have the parameters it is set to false .