public function loadUser(string $username): ?UserInterface
    {
        if (!isset($this->cache[$username])) {
            $this->cache[$username] = $this->user_provider->loadUserByUsername($username);
        }

        return $this->cache[$username] ?: null;
    }
public function loadUser(string $username): ?UserInterface
    {
        if (!isset($this->cache[$username])) {
            $this->cache[$username] = $this->user_provider->loadUserByUsername($username);
        }

        return $this->cache[$username] ?: null;
    }
public function loadUser ( string $ username ) : ? UserInterface { if ( ! isset ( $ this -> cache [ $ username ] ) ) { $ this -> cache [ $ username ] = $ this -> user_provider -> loadUserByUsername ( $ username ) ; } return $ this -> cache [ $ username ] ? : null ; }
Load a user using available user provider.

@param string $username The username to load.

@return ?UserInterface
Load a user using available user provider .