@param string $username
@param string|null $type

@return array
@throws Exception\BadResponseException
@throws ParserException
191928
public function UserHistory(string $username, ?string $type = null): array
    {
        return $this->myanimelist->getUserHistory(
            new Request\User\UserHistoryRequest($username, $type)
        );
    }
1043859
public Observable<ServiceResponse<ListLabsResponseInner>> listLabsWithServiceResponseAsync(String userName) {
        if (userName == null) {
            throw new IllegalArgumentException("Parameter userName is required and cannot be null.");
        }
        if (this.client.apiVersion() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
        }
        return service.listLabs(userName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ListLabsResponseInner>>>() {
                @Override
                public Observable<ServiceResponse<ListLabsResponseInner>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<ListLabsResponseInner> clientResponse = listLabsDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }
880091
public function listPublicUserPerformedEvents(string $username): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events/public', $username));
    }
910091
public function getUserConfig($serverName, $userName)
    {
        list($response) = $this->getUserConfigWithHttpInfo($serverName, $userName);
        return $response;
    }
481883
public function getValues($type = null)
    {
        if ($type == null) {
            return $this->values;
        }

        $converter  = $this->converterFactory->getConverter($type);
        $resultList = [];

        foreach ($this->values as $riakObject) {
            $reference = new RiakObjectReference($riakObject, $this->location, $type);
            $converted = $converter->toDomain($reference);

            $resultList[] = $converted;
        }

        return new DomainObjectList($resultList);
    }
1137531
public function get($type = null)
    {
        $result = [];

        foreach ($this->session[$this->prefix] as $offset => $message) {
            if ($type === null || $message['type'] === $type) {
                $result[] = $message;
                unset($this->session[$this->prefix][$offset]);
            }
        }

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

        return $this->cache[$username] ?: null;
    }
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;
    }
1247800
public function getToken($username)
	{
		return isset($this->access_tokens[$username]) ? $this->access_tokens[$username] : null;
	}
821937
public function listPublicUserReceiveEvents(string $username): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events/public', $username));
    }
949106
public function getUserByUsername($username)
    {
        $return = array();

        $users = $this->repository->users;
        foreach ($users as $user) {
            if ($user->username == $username) {
                $return = $user;
                break;
            }
        }

        return $return;
    }
886527
public static function data(String $type = NULL)
    {
        $server =
        [
            NULL                         => $_SERVER,
            'name'                       => $_SERVER['SERVER_NAME']           ?? false,
            'admin'                      => $_SERVER['SERVER_ADMIN']          ?? false,
            'addr'                       => $_SERVER['SERVER_ADDR']           ?? false,
            'port'                       => $_SERVER['SERVER_PORT']           ?? false,
            'protocol'                   => $_SERVER['SERVER_PROTOCOL']       ?? false,
            'signature'                  => $_SERVER['SERVER_SIGNATURE']      ?? false,
            'software'                   => $_SERVER['SERVER_SOFTWARE']       ?? false,
            'remoteAddr'                 => $_SERVER['REMOTE_ADDR']           ?? false,
            'remotePort'                 => $_SERVER['REMOTE_PORT']           ?? false,
            'requestMethod'              => $_SERVER['REQUEST_METHOD']        ?? false,
            'requestUri'                 => $_SERVER['REQUEST_URI']           ?? false,
            'requestScheme'              => $_SERVER['REQUEST_SCHEME']        ?? false,
            'requestTime'                => $_SERVER['REQUEST_TIME']          ?? false,
            'requestTimeFloat'           => $_SERVER['REQUEST_TIME_FLOAT']    ?? false,
            'accept'                     => $_SERVER['HTTP_ACCEPT']           ?? false,
            'acceptCharset'              => $_SERVER['HTTP_ACCEPT_CHARSET']   ?? false,
            'acceptEncoding'             => $_SERVER['HTTP_ACCEPT_ENCODING']  ?? false,
            'acceptLanguage'             => $_SERVER['HTTP_ACCEPT_LANGUAGE']  ?? false,
            'clientIp'                   => $_SERVER['HTTP_CLIENT_IP']        ?? false,
            'xForwardedHost'             => $_SERVER['HTTP_X_FORWARDED_HOST'] ?? false,
            'xForwardedFor'              => $_SERVER['HTTP_X_FORWARDED_FOR']  ?? false,
            'xOriginalUrl'               => $_SERVER['HTTP_X_ORIGINAL_URL']   ?? false,
            'xRequestedWith'             => $_SERVER['HTTP_X_REQUESTED_WITH'] ?? false,
            'connection'                 => $_SERVER['HTTP_CONNECTION']       ?? false,
            'host'                       => $_SERVER['HTTP_HOST']             ?? false,
            'referer'                    => $_SERVER['HTTP_REFERER']          ?? false,
            'userAgent'                  => $_SERVER['HTTP_USER_AGENT']       ?? false,
            'cookie'                     => $_SERVER['HTTP_COOKIE']           ?? false,
            'cacheControl'               => $_SERVER['HTTP_CACHE_CONTROL']    ?? false,
            'https'                      => $_SERVER['HTTPS']                 ?? false,
            'scriptFileName'             => $_SERVER['SCRIPT_FILENAME']       ?? false,
            'scriptName'                 => $_SERVER['SCRIPT_NAME']           ?? false,
            'path'                       => $_SERVER['PATH']                  ?? false,
            'pathInfo'                   => $_SERVER['PATH_INFO']             ?? false,
            'currentPath'                => $_SERVER['PATH_INFO']             ?? $_SERVER['QUERY_STRING'] ?? false,
            'pathTranslated'             => $_SERVER['PATH_TRANSLATED']       ?? false,
            'pathext'                    => $_SERVER['PATHEXT']               ?? false,
            'redirectQueryString'        => $_SERVER['REDIRECT_QUERY_STRING'] ?? false,
            'redirectUrl'                => $_SERVER['REDIRECT_URL']          ?? false,
            'redirectStatus'             => $_SERVER['REDIRECT_STATUS']       ?? false,
            'phpSelf'                    => $_SERVER['PHP_SELF']              ?? false,
            'queryString'                => $_SERVER['QUERY_STRING']          ?? false,
            'documentRoot'               => $_SERVER['DOCUMENT_ROOT']         ?? false,
            'windir'                     => $_SERVER['WINDIR']                ?? false,
            'comspec'                    => $_SERVER['COMSPEC']               ?? false,
            'systemRoot'                 => $_SERVER['SystemRoot']            ?? false,
            'gatewayInterface'           => $_SERVER['GATEWAY_INTERFACE']     ?? false
        ];

        if( isset($server[$type]) )
        {
            if( is_array($server[$type]) )
            {
                return $server[$type];
            }
            else
            {
                $return = htmlspecialchars($server[$type], ENT_QUOTES, "utf-8");
            }
        }
        elseif( isset($_SERVER[$type]) )
        {
            $return = htmlspecialchars($_SERVER[$type], ENT_QUOTES, "utf-8");
        }

        // 5.4.3[edited]
        return str_replace('&amp;', '&', $return) ?: false;
    }
378566
public function authenticateUser($username, $password, array $status)
    {
        if (empty($password)) {
            return null;
        }

        // allow login either through username or email
        if (preg_match('/' . BackendSchema\User::NAME_PATTERN . '/', $username)) {
            $column = 'name';
        } else {
            $column = 'email';
        }

        $condition = new Condition();
        $condition->equals($column, $username);
        $condition->in('status', $status);

        $user = $this->userTable->getOneBy($condition);

        if (!empty($user)) {
            // we can authenticate only local users
            if ($user['provider'] != ProviderInterface::PROVIDER_SYSTEM) {
                return null;
            }

            if ($user['status'] == Table\User::STATUS_DISABLED) {
                throw new StatusCode\BadRequestException('The assigned account is disabled');
            }

            if ($user['status'] == Table\User::STATUS_DELETED) {
                throw new StatusCode\BadRequestException('The assigned account is deleted');
            }

            // check password
            if (password_verify($password, $user['password'])) {
                return $user['id'];
            } else {
                $this->eventDispatcher->dispatch(UserEvents::FAIL_AUTHENTICATION, new FailedAuthenticationEvent(UserContext::newContext($user['id'])));
            }
        }

        return null;
    }
859905
protected function getFunctions($type = null)
    {
        $funcs = \get_defined_functions();

        if ($type) {
            return $funcs[$type];
        } else {
            return \array_merge($funcs['internal'], $funcs['user']);
        }
    }
285321
protected function loginByToken($username, \Espo\Entities\AuthToken $authToken = null)
    {
        if (!isset($authToken)) {
            return null;
        }

        $userId = $authToken->get('userId');
        $user = $this->getEntityManager()->getEntity('User', $userId);

        $tokenUsername = $user->get('userName');
        if (strtolower($username) != strtolower($tokenUsername)) {
            $GLOBALS['log']->alert('Unauthorized access attempt for user ['.$username.'] from IP ['.$_SERVER['REMOTE_ADDR'].']');
            return null;
        }

        $user = $this->getEntityManager()->getRepository('User')->findOne(array(
            'whereClause' => array(
                'userName' => $username,
            )
        ));

        return $user;
    }
644430
public function listSubscriptions(string $username = null): array
    {
        if (null !== $username) {
            return $this->getApi()->request($this->getApi()->sprintf('/users/:username/subscriptions',
                $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), $username));
        }

        return $this->getApi()->request($this->getApi()
                                             ->sprintf('/user/subscriptions', $this->getActivity()->getOwner(),
                                                 $this->getActivity()->getRepo()));
    }
329997
public function get($type, $name)
    {
        return isset($this->clients[$type][$name]) ? $this->clients[$type][$name] : null;
    }