Documentación de Proyecto Sincro

Users implements JsonSerializable

Entidad que representa a la tabla users del sistema Gestiona los datos del perfil y el control y verificación de contraseñas

Tags
requires

PHP 8.0 Uso de str_starts_with() y tipado de propiedades.

Table of Contents

Interfaces

JsonSerializable

Properties

$apellido1  : string
$apellido2  : string
$centro  : int
$cif  : string
$dni  : string
$email  : string
$habilitado  : int
$id  : int
$nombre  : string
$pass  : string
$ultimoacceso  : string

Methods

fromArray()  : Users
getApellido1()  : string
getApellido2()  : string
getCentro()  : int
getCif()  : string
getEmail()  : string
getId()  : int
getNombre()  : string
getNombreCompleto()  : string
getUltimoAcceso()  : string
hashPassword()  : string
Genera un hash bcrypt (coste 12).
isActivo()  : bool
jsonSerialize()  : array<string|int, mixed>
Serialización segura — PASS y DNI excluidos permanentemente.
verifyPassword()  : bool
Verifica la contraseña contra el hash almacenado.
__construct()  : mixed

Properties

$apellido1

private string $apellido1

$apellido2

private string $apellido2

$email

private string $email

$habilitado

private int $habilitado

$nombre

private string $nombre

$ultimoacceso

private string $ultimoacceso

Methods

fromArray()

public static fromArray(array<string|int, mixed> $data) : Users
Parameters
$data : array<string|int, mixed>
Return values
Users

getApellido1()

public getApellido1() : string
Return values
string

getApellido2()

public getApellido2() : string
Return values
string

getCentro()

public getCentro() : int
Return values
int

getCif()

public getCif() : string
Return values
string

getEmail()

public getEmail() : string
Return values
string

getId()

public getId() : int
Return values
int

getNombre()

public getNombre() : string
Return values
string

getNombreCompleto()

public getNombreCompleto() : string
Return values
string

getUltimoAcceso()

public getUltimoAcceso() : string
Return values
string

hashPassword()

Genera un hash bcrypt (coste 12).

public static hashPassword(string $plainPassword) : string

Usar para crear usuarios o migrar contraseñas legacy.

Parameters
$plainPassword : string
Return values
string

isActivo()

public isActivo() : bool
Return values
bool

jsonSerialize()

Serialización segura — PASS y DNI excluidos permanentemente.

public jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

verifyPassword()

Verifica la contraseña contra el hash almacenado.

public verifyPassword(string $plainPassword[, bool &$needsRehash = false ]) : bool

Único punto donde $this->pass se consume — nunca sale del objeto.

Soporta bcrypt (moderno), MD5 y SHA1 (legacy, activa rehash).

Parameters
$plainPassword : string
$needsRehash : bool = false
Return values
bool

__construct()

private __construct(int $id, string $nombre, string $apellido1, string $apellido2, string $email, string $dni, string $pass, int $habilitado, int $centro, string $cif, string $ultimoacceso) : mixed
Parameters
$id : int
$nombre : string
$apellido1 : string
$apellido2 : string
$email : string
$dni : string
$pass : string
$habilitado : int
$centro : int
$cif : string
$ultimoacceso : string

        
On this page

Search results