public function newAuth($parameters = array(), $authMethod = 'OAuth')
    {
        $class      = 'Mautic\\Auth\\'.$authMethod;
        $authObject = new $class();

        $reflection = new \ReflectionMethod($class, 'setup');
        $pass       = array();

        foreach ($reflection->getParameters() as $param) {
            if (isset($parameters[$param->getName()])) {
                $pass[] = $parameters[$param->getName()];
            } else {
                $pass[] = null;
            }
        }

        $reflection->invokeArgs($authObject, $pass);

        return $authObject;
    }
public function newAuth($parameters = array(), $authMethod = 'OAuth')
    {
        $class      = 'Mautic\\Auth\\'.$authMethod;
        $authObject = new $class();

        $reflection = new \ReflectionMethod($class, 'setup');
        $pass       = array();

        foreach ($reflection->getParameters() as $param) {
            if (isset($parameters[$param->getName()])) {
                $pass[] = $parameters[$param->getName()];
            } else {
                $pass[] = null;
            }
        }

        $reflection->invokeArgs($authObject, $pass);

        return $authObject;
    }
public function newAuth ( $ parameters = array ( ) , $ authMethod = 'OAuth' ) { $ class = 'Mautic\\Auth\\' . $ authMethod ; $ authObject = new $ class ( ) ; $ reflection = new \ ReflectionMethod ( $ class , 'setup' ) ; $ pass = array ( ) ; foreach ( $ reflection -> getParameters ( ) as $ param ) { if ( isset ( $ parameters [ $ param -> getName ( ) ] ) ) { $ pass [ ] = $ parameters [ $ param -> getName ( ) ] ; } else { $ pass [ ] = null ; } } $ reflection -> invokeArgs ( $ authObject , $ pass ) ; return $ authObject ; }
Get an API Auth object

@param array  $parameters
@param string $authMethod

@return AuthInterface
Get an API Auth object