protected function getExistingMatchingUser(array $args)
    {
        $user_id = $this->getUserIdFromLogin($args['user_login']);
        $user    = $this->getDriver()->user->get($user_id);

        /* users can have more than one role so needs to be a special case */
        if (array_key_exists('role', $args)) {
            $this->checkUserHasRole($user, $args['role']);
        }

        /*
         * Loop through each of the passed arguements.
         * if they are arguments which apply to users
         * then check that that which exist matches that which was specified.
         */
        foreach ($args as $parameter => $value) {
            if ($parameter === 'password') {
                continue;
            }

            if ($this->isValidUserParameter($parameter) && $user->$parameter !== $args[$parameter]) {
                throw new UnexpectedValueException('[W804] User with login: ' . $user->user_login . 'exists, but ' . $parameter . ' is ' . $user->$parameter . ' not ' . $args[$parameter] . 'which was specified');
            }
        }

        return $user;
    }
protected function getExistingMatchingUser(array $args)
    {
        $user_id = $this->getUserIdFromLogin($args['user_login']);
        $user    = $this->getDriver()->user->get($user_id);

        /* users can have more than one role so needs to be a special case */
        if (array_key_exists('role', $args)) {
            $this->checkUserHasRole($user, $args['role']);
        }

        /*
         * Loop through each of the passed arguements.
         * if they are arguments which apply to users
         * then check that that which exist matches that which was specified.
         */
        foreach ($args as $parameter => $value) {
            if ($parameter === 'password') {
                continue;
            }

            if ($this->isValidUserParameter($parameter) && $user->$parameter !== $args[$parameter]) {
                throw new UnexpectedValueException('[W804] User with login: ' . $user->user_login . 'exists, but ' . $parameter . ' is ' . $user->$parameter . ' not ' . $args[$parameter] . 'which was specified');
            }
        }

        return $user;
    }
protected function getExistingMatchingUser ( array $ args ) { $ user_id = $ this -> getUserIdFromLogin ( $ args [ 'user_login' ] ) ; $ user = $ this -> getDriver ( ) -> user -> get ( $ user_id ) ; /* users can have more than one role so needs to be a special case */ if ( array_key_exists ( 'role' , $ args ) ) { $ this -> checkUserHasRole ( $ user , $ args [ 'role' ] ) ; } /*
         * Loop through each of the passed arguements.
         * if they are arguments which apply to users
         * then check that that which exist matches that which was specified.
         */ foreach ( $ args as $ parameter => $ value ) { if ( $ parameter === 'password' ) { continue ; } if ( $ this -> isValidUserParameter ( $ parameter ) && $ user -> $ parameter !== $ args [ $ parameter ] ) { throw new UnexpectedValueException ( '[W804] User with login: ' . $ user -> user_login . 'exists, but ' . $ parameter . ' is ' . $ user -> $ parameter . ' not ' . $ args [ $ parameter ] . 'which was specified' ) ; } } return $ user ; }
Get a user which matches all parameters.

Fetches a user if all the passed parameters match
if none is found then UnexpectedValueException is thrown.

@param array $args Keyed array of parameters.

@throws \UnexpectedValueException

@return object $user
Get a user which matches all parameters .