@param string $lastname

@throws \InvalidArgumentException
@return Applicant
492661
public function setLastname($lastname)
    {
        if (!is_string($lastname) && !is_null($lastname)) {
            throw new \InvalidArgumentException(__CLASS__ . ' ' . __METHOD__ . ': Not a string');
        }

        $this->lastname = $lastname;

        return $this;
    }
147100
public function usernameValidator($username)
    {
        if (empty($username)) {
            throw new \Exception('The username can not be empty');
        }

        $userManager = $this->getUserManager();
        if ($userManager->usernameExists($username)) {
            throw new \Exception('The username is already used.');
        }

        return $username;
    }
530962
public static function get_last_name($source) {
		$name = explode(' ', self::parse_source_path('info.name', $source));
		array_shift($name);
		return join(' ', $name);
	}
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;
    }
458539
public function setNames($firstname, $lastname, $fullname)
    {

        $names = array(0 => '', 1 => '');
        if (!empty($fullname)) {
            $this->fullname = trim($fullname);
            $names = preg_split("/[\s]+/", $this->fullname, 2);
        }
        if (!empty($firstname)) {
            $this->firstname = trim($firstname);
            $names[0] = $this->firstname;
        } else if (!empty($names[0])) {
            $this->firstname = $names[0];
        } else {
            $this->firstname = 'User';
        }
        if (!empty($lastname)) {
            $this->lastname = trim($lastname);
            $names[1] = $this->lastname;
        } else if (!empty($names[1])) {
            $this->lastname = $names[1];
        } else {
            $this->lastname = $this->ltiUserId;
        }
        if (empty($this->fullname)) {
            $this->fullname = "{$this->firstname} {$this->lastname}";
        }

    }
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);
    }
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;
        }
    }
1307465
public function getBasket($sName)
    {
        if (!isset($this->_aBaskets[$sName])) {
            /** @var \OxidEsales\Eshop\Application\Model\UserBasket $oBasket */
            $oBasket = oxNew(\OxidEsales\Eshop\Application\Model\UserBasket::class);
            $aWhere = ['oxuserbaskets.oxuserid' => $this->getId(), 'oxuserbaskets.oxtitle' => $sName];

            // creating if it does not exist
            if (!$oBasket->assignRecord($oBasket->buildSelectString($aWhere))) {
                $oBasket->oxuserbaskets__oxtitle = new \OxidEsales\Eshop\Core\Field($sName);
                $oBasket->oxuserbaskets__oxuserid = new \OxidEsales\Eshop\Core\Field($this->getId());

                // marking basket as new (it will not be saved in DB yet)
                $oBasket->setIsNewBasket();
            }

            $this->_aBaskets[$sName] = $oBasket;
        }

        return $this->_aBaskets[$sName];
    }
1219794
public function lastIndexByName($name) {
        for ($i = count($this->tokens) - 1; $i >= 0; $i--) {
            if ($this->tokens[$i]->getName() === $name) {
                return $i;
            }
        }

        return null;
    }
875622
public final function useRoute(string $fileName): ApplicationInterface
    {
        try {
            if (!$this->router) {
                $this->router = $this->getRouter();
            }
            $this->router->import($fileName);
        } catch (InvalidArgumentException $e) {
            throw new InvalidArgumentException(
                "Can't use routes: ". $e->getMessage()
            );
        }
        return $this;
    }
846618
public function listByApplyId(int $applyId, int $lastId, int $count)
    {
        $params = [
            'type' => 3,
            'apply_id' => $applyId,
            'last_seen' => $lastId,
            'count' => $count,
        ];

        return $this->search($params);
    }
514313
public function create($first_name, $last_name, $email, $active, $password)
	{
		$password = Hash::make($password);

		return User::create(compact('first_name', 'last_name', 'email', 'password', 'active'));
	}
630730
public function setLastName($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->last_name !== $v) {
            $this->last_name = $v;
            $this->modifiedColumns[PersonTableMap::LAST_NAME] = true;
        }


        return $this;
    }
1012531
public function getByUsername($username)
    {
        $filter = new IteratorFilter();
        $filter->addRelation($this->getUserDefinition()->getUsername(), Relation::EQUAL, $username);
        return $this->getUser($filter);
    }
908541
private function findByUsername(string $username)
    {
        if ($this->userRepository instanceof UserRepositoryInterface) {
            return $this->userRepository->findByUsername($username);
        }

        return $this->userRepository->findOneBy(['username' => $username]);
    }
449817
private function addStandardApplicant(
        $firstName,
        callable $callback = null
    )
    {
        $applicant = new Applicant();
        $eligibility = new Eligibility();
        $nationality = new Nationality();
        $registration = new Registration();

        $nationality->setName('British');

        $eligibility->setPresentNationality($nationality);
        $eligibility->setSubjectToImmigrationControls(true);
        $eligibility->setSubjectToImmigrationControlsDetails('I require a Visa');
        $eligibility->setResidencyOrEmploymentRestrictions(false);
        $eligibility->setPermissionToCheckBackground(true);

        $registration->setHeardAboutUs('I have heard');
        $registration->setDisabledDetails('I am disabled');
        $registration->setDisabledAdjustmentDetails('I would like an adjustment');

        $applicant->setEnabled(true);
        $applicant->setEmail(strtolower($firstName).'@test.com');
        $applicant->setPlainPassword('P@ssword1');
        $applicant->setUsername(md5($firstName));
        $applicant->setFirstname($firstName);
        $applicant->setLastname('Persona');

        $applicant->setAddress(
            (new Address())
                ->setLine1('123 Some Street')
                ->setTown('Some Town')
                ->setCounty('Some County')
                ->setPostcode('AB12 3CD')
                ->setCountry('GB')
        );

        $applicant->setPhoneNumber(
            (new PhoneNumber())
                ->setNumber('123456789')
        );

        $applicant->setEligibility($eligibility);
        $applicant->setRegistration($registration);

        if ($callback != null) {
            $callback($applicant);
        }

        $this->manager->persist($applicant);

        return $applicant;
    }
274063
public function getFromUsername( $username ) {
		$result = $this->api->getRequest(
			new SimpleRequest(
				'query', [
				'list' => 'users',
				'ususers' => $username,
				'usprop' => 'gender|emailable|registration|editcount|rights|implicitgroups|groups|blockinfo',
			]
			)
		);

		return $this->newUserFromListUsersResult( array_shift( $result['query']['users'] ) );
	}