@param string $lastName

@return UserInterface
347030
public function setLastName($lastName)
    {
        if (!empty($lastName) && is_string($lastName) && ctype_print($lastName)) {
            $this->lastName = trim($lastName);
        }

        return $this;
    }
22475
public function setProfileName($firstName, $lastName)
    {
        return $this->exec('set_profile_name ' . $this->escapeStringArgument($firstName) . ' '
            . $this->escapeStringArgument($lastName));
    }
876687
protected function createUser($username)
    {
        return $this->userFactory->createUser()
            ->setEmail($username)
            ->setEnabled(true)
            ->setLocked(false)
            ->generateRandomPlainPassword();
    }
528687
public function loadUserByUsername($username)
    {
        $user = $this->segmentalizer->loadUserByUsername($username);
        if (call_user_func($this->filter, $user)) {
            return $user;
        }
        throw new UsernameNotFoundException(sprintf('Username "%s" does not exist.', $username));
    }
334719
protected function findUser(OutputInterface $output, string $username): ?User
    {
        try {
            /** @var User $user */

            return $this->userManager->loadUserByUsername($username);
        } catch (UsernameNotFoundException $e) {
            $message = $this->translator->trans(
                'user.does_not_exists',
                ['%username%' => $username],
                'security'
            );
            $output->writeln("<error>{$message}</error>");

            return null;
        }
    }
1262374
public function loadUserByUsername($username)
    {
        if (!$this->authTokenService->isValid($username)) {
            throw new UsernameNotFoundException("Invalid Token.");
        }

        try {

            return $this->authTokenService->getUser($username);
        } catch (ProgrammerException $ex) {
            throw new UsernameNotFoundException($ex->getMessage(), $ex->getCode());
        }
    }
780976
public function setLastName($lastName = null)
    {
        if (($this->getMajorProtocolVersion() == null) ||
           ($this->getMajorProtocolVersion() == 1)) {
            require_once 'Zend/Gdata/App/VersionException.php';
            throw new Zend_Gdata_App_VersionException('The setLastName ' .
                ' method is only supported as of version 2 of the YouTube ' .
                'API.');
        } else {
            $this->_lastName = $lastName;
            return $this;
        }
    }
775641
public function userRecentTracks(string $username): Lastfm
    {
        $this->query = array_merge($this->query, [
            'method' => 'user.getRecentTracks',
            'user' => $username,
        ]);

        $this->pluck = 'recenttracks.track';

        return $this;
    }
80340
public function logout($username = null)
    {
        return $this->performRequest('/status/user/'.(is_null($username) ? $this->user
                    : $username).'/logout', 'POST');
    }
1236756
protected static function getEmailByUsername($username)
    {
        if (empty($username)) {
            throw new BadRequestException("Missing required username.");
        }

        /** @var User $user */
        $user = User::whereUsername($username)->get(['email'])->first();

        if (empty($user)) {
            throw new NotFoundException('The supplied username was not found in the system.');
        }

        return $user->email;
    }
120633
public function setName($routeName)
    {
        $lastMethod = $this->lastRouteMethod;
        $lastIndex = count($this->routes[$lastMethod])-1;
        $indexName = $lastMethod.':'.$lastIndex;
        $this->routeNames[$indexName] = $routeName;

        $rota = $this->routes[$lastMethod][$lastIndex];
        $rota->setName($routeName);
        $this->routes[$lastMethod][$lastIndex] = $rota;

        return $this;
    }
616028
public static function getUserLastName(User $user, $defaultToLabel = false)
    {
        $lastName = self::getUserStringProp($user, GenerisRdf::PROPERTY_USER_LASTNAME);

        if (empty($lastName) && $defaultToLabel) {
            $lastName = self::getUserLabel($user);
        }
        
        return $lastName;
    }
1245505
public function loadUserByUsername($username)
    {
        if (null === $user = $this->findOneBy(array('_login' => $username))) {
            throw new UsernameNotFoundException(sprintf('Unknown username `%s`.', $username));
        }

        return $this->checkActivatedStatus($user);
    }
480894
public function createUsername($username)
    {
        if (!$this->hasEnabledUsername()) {
            return null;
        }
        $usernameClass = $this->usernameClass;
        $model = $usernameClass::findOne($this->getGUID());
        if (!$model) {
            $model = $this->create($usernameClass);
            $model->setGUID($this->getGUID());
        }
        $model->content = $username;
        return $model;
    }
1242301
public function loadUserByUsername($username)
    {
        /** @var User|UserInterface $user */
        $user = $this->getRepository()->findOneBy(['username' => $username]);
        if (!$user && $this->allowEmailAsUsername) {
            $user = $this->getRepository()->findOneBy(['email' => $username]);
        }
        if ($user) {
            return $user;
        }

        throw new UsernameNotFoundException($username);
    }
328516
public function setUserClass(string $classname)
    {
        if (!class_exists($classname) || !is_subclass_of($classname, UserInterface::class))
            throw new DomainException("Invalid user class: $classname");
        $this->user_class = $classname;
        return $this;
    }
152303
private function getUser($username)
    {
        if (!isset($this->users[strtolower($username)])) {
            $ex = new UsernameNotFoundException(sprintf('Username "%s" does not exist.', $username));
            $ex->setUsername($username);

            throw $ex;
        }

        return $this->users[strtolower($username)];
    }