UserInterface
extends
AuthorizeInterface, DataInterface, MediaInterface, ArrayAccess, JsonSerializable, ExportInterface
in
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
boolauthorize()
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|nullblueprints()
Return blueprints.
public
blueprints() : Blueprint
Return values
Blueprintdef()
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
Return values
$thisexists()
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
boolextra()
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
FileInterfacefilter()
Filter all items by using blueprints.
public
filter() : $this
Return values
$thisget()
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
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|nullgetAvatarUrl()
Return the User's avatar URL.
public
getAvatarUrl() : string
Return values
stringgetDefaults()
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
Return values
array<string|int, mixed>getMedia()
Gets the associated media collection.
public
getMedia() : MediaCollectionInterface
Return values
MediaCollectionInterface —Collection of associated media.
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
Return values
$thisjoinDefaults()
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
$thismerge()
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
stringsave()
Save data into the file.
public
save() : void
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
Return values
$thissetDefaults()
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
$thisundef()
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
Return values
$thisupdate()
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
$thisvalidate()
Validate by blueprints.
public
validate() : $this
Tags
Return values
$thisvalue()
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
Return values
mixed —Value.