protected function parseCredentials(array $credentials, array $loginNames)
    {
        if (isset($credentials['password'])) {
            $password = $credentials['password'];

            unset($credentials['password']);
        } else {
            $password = null;
        }

        $passedNames = array_intersect_key($credentials, array_flip($loginNames));

        if (count($passedNames) > 0) {
            $logins = [];

            foreach ($passedNames as $name => $value) {
                $logins[$name] = $credentials[$name];
                unset($credentials[$name]);
            }
        } elseif (isset($credentials['login'])) {
            $logins = $credentials['login'];
            unset($credentials['login']);
        } else {
            $logins = [];
        }

        return [$logins, $password, $credentials];
    }
protected function parseCredentials(array $credentials, array $loginNames)
    {
        if (isset($credentials['password'])) {
            $password = $credentials['password'];

            unset($credentials['password']);
        } else {
            $password = null;
        }

        $passedNames = array_intersect_key($credentials, array_flip($loginNames));

        if (count($passedNames) > 0) {
            $logins = [];

            foreach ($passedNames as $name => $value) {
                $logins[$name] = $credentials[$name];
                unset($credentials[$name]);
            }
        } elseif (isset($credentials['login'])) {
            $logins = $credentials['login'];
            unset($credentials['login']);
        } else {
            $logins = [];
        }

        return [$logins, $password, $credentials];
    }
protected function parseCredentials ( array $ credentials , array $ loginNames ) { if ( isset ( $ credentials [ 'password' ] ) ) { $ password = $ credentials [ 'password' ] ; unset ( $ credentials [ 'password' ] ) ; } else { $ password = null ; } $ passedNames = array_intersect_key ( $ credentials , array_flip ( $ loginNames ) ) ; if ( count ( $ passedNames ) > 0 ) { $ logins = [ ] ; foreach ( $ passedNames as $ name => $ value ) { $ logins [ $ name ] = $ credentials [ $ name ] ; unset ( $ credentials [ $ name ] ) ; } } elseif ( isset ( $ credentials [ 'login' ] ) ) { $ logins = $ credentials [ 'login' ] ; unset ( $ credentials [ 'login' ] ) ; } else { $ logins = [ ] ; } return [ $ logins , $ password , $ credentials ] ; }
Parses the given credentials to return logins, password and others.

@param  array  $credentials
@param  array  $loginNames
@return array
@throws \InvalidArgumentException
Parses the given credentials to return logins password and others .