Documentation

UserInterface extends AuthorizeInterface, DataInterface, MediaInterface, ArrayAccess, JsonSerializable, ExportInterface

Interface UserInterface

Table of Contents

Methods

authenticate()  : bool
Authenticate user.
authorize()  : bool|null
Checks user authorization to the action.
blueprints()  : Blueprint
Return blueprints.
def()  : $this
Set default value by using dot notation for nested arrays/objects.
exists()  : bool
Returns whether the data already exists in the storage.
extra()  : array<string|int, mixed>
Get extra items which haven't been defined in blueprints.
file()  : FileInterface
Set or get the data storage.
filter()  : $this
Filter all items by using blueprints.
get()  : mixed
Get value by using dot notation for nested arrays/objects.
getAvatarImage()  : Medium|null
Return media object for the User's avatar.
getAvatarUrl()  : string
Return the User's avatar URL.
getDefaults()  : array<string|int, mixed>
Get nested structure containing default values defined in the blueprints.
getJoined()  : array<string|int, mixed>
Get value from the configuration and join it with given data.
getMedia()  : MediaCollectionInterface
Gets the associated media collection.
getMediaFolder()  : string|null
Get filesystem path to the associated media.
getMediaOrder()  : array<string|int, mixed>
Get display order for the associated media.
join()  : $this
Join nested values together by using blueprints.
joinDefaults()  : $this
Set default values by using blueprints.
merge()  : mixed
Merge external data.
raw()  : string
Return unmodified data as raw string.
save()  : void
Save data into the file.
set()  : $this
Set value by using dot notation for nested arrays/objects.
setDefaults()  : $this
Set default values to the configuration if variables were not set.
undef()  : $this
Unset value by using dot notation for nested arrays/objects.
update()  : $this
Update object with data
validate()  : $this
Validate by blueprints.
value()  : mixed
Get value by using dot notation for nested arrays/objects.

Methods

authenticate()

Authenticate user.

public authenticate(string $password) : bool

If user password needs to be updated, new information will be saved.

Parameters
$password : string

Plaintext password.

Return values
bool

authorize()

Checks user authorization to the action.

public authorize(string $action[, string|null $scope = null ]) : bool|null
Parameters
$action : string
$scope : string|null = null
Return values
bool|null

def()

Set default value by using dot notation for nested arrays/objects.

public def(string $name[, mixed $default = null ][, string|null $separator = null ]) : $this
Parameters
$name : string

Dot separated path to the requested value.

$default : mixed = null

Default value (or null).

$separator : string|null = null

Separator, defaults to '.'

Tags
example

$data->def('this.is.my.nested.variable', 'default');

Return values
$this

exists()

Returns whether the data already exists in the storage.

public exists() : bool

NOTE: This method does not check if the data is current.

Return values
bool

extra()

Get extra items which haven't been defined in blueprints.

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

file()

Set or get the data storage.

public file([FileInterface|null $storage = null ]) : FileInterface
Parameters
$storage : FileInterface|null = null

Optionally enter a new storage.

Return values
FileInterface

filter()

Filter all items by using blueprints.

public filter() : $this
Return values
$this

get()

Get value by using dot notation for nested arrays/objects.

public get(string $name[, mixed $default = null ][, string|null $separator = null ]) : mixed
Parameters
$name : string

Dot separated path to the requested value.

$default : mixed = null

Default value (or null).

$separator : string|null = null

Separator, defaults to '.'

Tags
example

$value = $this->get('this.is.my.nested.variable');

Return values
mixed

Value.

getAvatarImage()

Return media object for the User's avatar.

public getAvatarImage() : Medium|null

Note: if there's no local avatar image for the user, you should call getAvatarUrl() to get the external avatar URL.

Return values
Medium|null

getAvatarUrl()

Return the User's avatar URL.

public getAvatarUrl() : string
Return values
string

getDefaults()

Get nested structure containing default values defined in the blueprints.

public getDefaults() : array<string|int, mixed>

Fields without default value are ignored in the list.

Return values
array<string|int, mixed>

getJoined()

Get value from the configuration and join it with given data.

public getJoined(string $name, array<string|int, mixed>|object $value[, string $separator = '.' ]) : array<string|int, mixed>
Parameters
$name : string

Dot separated path to the requested value.

$value : array<string|int, mixed>|object

Value to be joined.

$separator : string = '.'

Separator, defaults to '.'

Tags
throws
RuntimeException
Return values
array<string|int, mixed>

getMediaFolder()

Get filesystem path to the associated media.

public getMediaFolder() : string|null
Return values
string|null

Media path or null if the object doesn't have media folder.

getMediaOrder()

Get display order for the associated media.

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

Empty array means default ordering.

join()

Join nested values together by using blueprints.

public join(string $name, mixed $value[, string $separator = '.' ]) : $this
Parameters
$name : string

Dot separated path to the requested value.

$value : mixed

Value to be joined.

$separator : string = '.'

Separator, defaults to '.'

Tags
throws
RuntimeException
Return values
$this

joinDefaults()

Set default values by using blueprints.

public joinDefaults(string $name, mixed $value[, string $separator = '.' ]) : $this
Parameters
$name : string

Dot separated path to the requested value.

$value : mixed

Value to be joined.

$separator : string = '.'

Separator, defaults to '.'

Return values
$this

merge()

Merge external data.

public merge(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>

raw()

Return unmodified data as raw string.

public raw() : string

NOTE: This function only returns data which has been saved to the storage.

Return values
string

set()

Set value by using dot notation for nested arrays/objects.

public set(string $name, mixed $value[, string|null $separator = null ]) : $this
Parameters
$name : string

Dot separated path to the requested value.

$value : mixed

New value.

$separator : string|null = null

Separator, defaults to '.'

Tags
example

$data->set('this.is.my.nested.variable', $value);

Return values
$this

setDefaults()

Set default values to the configuration if variables were not set.

public setDefaults(array<string|int, mixed> $data) : $this
Parameters
$data : array<string|int, mixed>
Return values
$this

undef()

Unset value by using dot notation for nested arrays/objects.

public undef(string $name[, string|null $separator = null ]) : $this
Parameters
$name : string

Dot separated path to the requested value.

$separator : string|null = null

Separator, defaults to '.'

Tags
example

$data->undef('this.is.my.nested.variable');

Return values
$this

update()

Update object with data

public update(array<string|int, mixed> $data[, array<string|int, mixed> $files = [] ]) : $this
Parameters
$data : array<string|int, mixed>
$files : array<string|int, mixed> = []
Return values
$this

validate()

Validate by blueprints.

public validate() : $this
Tags
throws
Exception
Return values
$this

value()

Get value by using dot notation for nested arrays/objects.

public value(string $name[, mixed $default = null ][, string $separator = '.' ]) : mixed
Parameters
$name : string

Dot separated path to the requested value.

$default : mixed = null

Default value (or null).

$separator : string = '.'

Separator, defaults to '.'

Tags
example

$value = $data->value('this.is.my.nested.variable');

Return values
mixed

Value.


        
On this page

Search results