Attribute
in package
implements
AttributeBag
PHP Mini Framework
Tags
Interfaces, Classes, Traits and Enums
- AttributeBag
- PHP Mini Framework
Table of Contents
- $attributes : array<string|int, mixed>
- $onChange : Closure|null
- $onDelete : Closure|null
- __construct() : mixed
- __toString() : string
- Gets a string representation of the object
- all() : array<string|int, mixed>
- Get all attributes
- clear() : void
- Remove all attribute
- get() : mixed
- Get attribute
- has() : bool
- Checks if an attribute exists
- mirror() : self
- Mirror attributes with external source
- onChange() : self
- Set on attribute change listner
- onDelete() : self
- Set on attribute delete listner
- pull() : mixed
- Pull attribute: Get and delete
- remove() : void
- Remove attribute
- replace() : void
- Set bulk attributes
- set() : bool
- Set attribute
Properties
$attributes
protected
array<string|int, mixed>
$attributes
= []
Tags
$onChange
protected
Closure|null
$onChange
= null
Tags
$onDelete
protected
Closure|null
$onDelete
= null
Tags
Methods
__construct()
public
__construct([array<string|int, mixed> $attributes = [] ]) : mixed
Parameters
- $attributes : array<string|int, mixed> = []
Tags
Return values
mixed —__toString()
Gets a string representation of the object
public
__toString() : string
Tags
Return values
string —Returns the string representation of the object.
all()
Get all attributes
public
all() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —clear()
Remove all attribute
public
clear() : void
Tags
Return values
void —get()
Get attribute
public
get(string $name[, mixed $default = null ]) : mixed
Parameters
- $name : string
- $default : mixed = null
Tags
Return values
mixed —has()
Checks if an attribute exists
public
has(string $name) : bool
Parameters
- $name : string
Tags
Return values
bool —mirror()
Mirror attributes with external source
public
mirror(mixed &$attributes) : self
Parameters
- $attributes : mixed
Tags
Return values
self —onChange()
Set on attribute change listner
public
onChange(Closure $onChange) : self
Parameters
- $onChange : Closure
Return values
self —onDelete()
Set on attribute delete listner
public
onDelete(Closure $onDelete) : self
Parameters
- $onDelete : Closure
Return values
self —pull()
Pull attribute: Get and delete
public
pull(string $name[, mixed $default = null ]) : mixed
Parameters
- $name : string
- $default : mixed = null
Tags
Return values
mixed —remove()
Remove attribute
public
remove(string $name) : void
Parameters
- $name : string
Tags
Return values
void —replace()
Set bulk attributes
public
replace(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
Tags
Return values
void —set()
Set attribute
public
set(string $name, mixed $value[, mixed $options = NULL ]) : bool
Parameters
- $name : string
- $value : mixed
- $options : mixed = NULL