Skip to content

API User

Christophe SAUVEUR edited this page Nov 23, 2024 · 3 revisions

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|int|null

Gets the current user identifier

Since 2.0

Returns

string|int|null 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|int|null $id): bool

Validates the user from its identifier

Since 2.0

Parameters

Name Type Description
$id `string int

Returns

boolean true if the user identifier is valid, false either


Clone this wiki locally