concrete/src/Entity/User/LoginAttemptRepository.php
private function validateUser($user, $requireValue = false)
    {
        // If we're passed something falsy, just return null
        if (!$user && !$requireValue) {
            return null;
        }

        // If we have a known supported type, resolve the id and return it
        if ($user instanceof User || $user instanceof UserInfo) {
            return (int) $user->getUserID();
        }

        // If what we're left with is numeric, return it as an int
        if (is_numeric($user)) {
            return (int) $user;
        }

        throw new \InvalidArgumentException('Invalid user value passed, must be User instance or int');
    }
private function validateUser($user, $requireValue = false)
    {
        // If we're passed something falsy, just return null
        if (!$user && !$requireValue) {
            return null;
        }

        // If we have a known supported type, resolve the id and return it
        if ($user instanceof User || $user instanceof UserInfo) {
            return (int) $user->getUserID();
        }

        // If what we're left with is numeric, return it as an int
        if (is_numeric($user)) {
            return (int) $user;
        }

        throw new \InvalidArgumentException('Invalid user value passed, must be User instance or int');
    }
private function validateUser ( $ user , $ requireValue = false ) { // If we're passed something falsy, just return null if ( ! $ user && ! $ requireValue ) { return null ; } // If we have a known supported type, resolve the id and return it if ( $ user instanceof User || $ user instanceof UserInfo ) { return ( int ) $ user -> getUserID ( ) ; } // If what we're left with is numeric, return it as an int if ( is_numeric ( $ user ) ) { return ( int ) $ user ; } throw new \ InvalidArgumentException ( 'Invalid user value passed, must be User instance or int' ) ; }
Validate a passed user value and resolve the ID

@param mixed $user
@param bool $requireValue Whether a user value is required

@return int|null

@throws \InvalidArgumentException
Validate a passed user value and resolve the ID