API User - chsxf/mfx GitHub Wiki

User Class

chsxf\MFX

class User

Summary

User description class

Since 1.0

Methods

__construct

public function __construct(Services\IAuthenticationService $authenticationService, Services\IDatabaseService $databaseService)

Constructor

Since 2.0

Parameters

Name Type Description
$authenticationService IAuthenticationService Authentication service instance
$databaseService IDatabaseService Database service instance

getId

public function getId(): string

Gets the current user identifier

Since 2.0

Returns

string The function returns NULL if no valid user is currently registered


isValid

public function isValid(): bool

Gets the current user status.

Since 1.0

Returns

boolean true if the current user is valid, false for guests


validateWithFields

public function validateWithFields(array $fields): bool

Validates a user from database fields

Since 2.0

Parameters

Name Type Description
$fields array Database fields used to identify the user

Returns

boolean true if the user is valid, false either


validateWithId

public function validateWithId(string $id): bool

Validates the user from its identifier

Since 2.0

Parameters

Name Type Description
$id string User identifier to validate

Returns

boolean true if the user identifier is valid, false either