BasicManager
class BasicManager implements ManagesItemsInterface, ContainerInterface
Manages deeply nested, complex data.
A basic manager class with no pizazz. Simply manages complex data. NOTE: this is not arrayable.
Traits
Methods
Hydrate with external data, optionally append
Push a value or values onto the end of an array inside manager
Get a single item
Return an item if it exist Alias of getIfExists()
Reset the manager with an array of items Alias of initManager()
Merge a set of defaults with the current items
Sets the name of the property that holds data items
When manager instance is used as a string, return json of items
Build a new manager instance
Details
in ManagesItemsTrait at line line 44
$this
initManager(array $items = null)
Initializes a new manager instance.
This is useful for implementations that have their own __construct method This is an alias for reset()
in ManagesItemsTrait at line line 72
$this
hydrate($data, bool $append = false)
Hydrate with external data, optionally append
in ManagesItemsTrait at line line 92
$this
add(string $alias, mixed $item = null)
Adds a single item.
Allow for dot notation (one.two.three) and item nesting.
in ManagesItemsTrait at line line 139
$this
set(string $alias, null $item = null)
Updates an item
in ManagesItemsTrait at line line 152
int
push(string $alias, mixed $value, null|mixed $other = null)
Push a value or values onto the end of an array inside manager
in ManagesItemsTrait at line line 183
mixed
get(string $alias, string $fallback = '_michaels_no_fallback')
Get a single item
in ManagesItemsTrait at line line 204
NoItemFoundMessage
getIfExists($alias)
Return an item if it exist
in ManagesItemsTrait at line line 225
NoItemFoundMessage
getIfHas($alias)
Return an item if it exist Alias of getIfExists()
in ManagesItemsTrait at line line 235
array
getAll()
Return all items as array
in ManagesItemsTrait at line line 246
array
all()
Return all items as array Alias of getAll()
in ManagesItemsTrait at line line 257
bool
exists($alias)
Confirm or deny that an item exists
in ManagesItemsTrait at line line 283
bool
has($alias)
Confirm or deny that an item exists Alias of exists()
in ManagesItemsTrait at line line 293
boolean
isEmpty()
Confirm that manager has no items
in ManagesItemsTrait at line line 305
$this
remove($alias)
Deletes an item
in ManagesItemsTrait at line line 326
$this
clear()
Clear the manager
in ManagesItemsTrait at line line 340
mixed
reset(array $items)
Reset the manager with an array of items Alias of initManager()
in ManagesItemsTrait at line line 350
$this
protect($item)
Guard an alias from being modified
in ManagesItemsTrait at line line 361
$this
loadDefaults(array $defaults)
Merge a set of defaults with the current items
in ManagesItemsTrait at line line 371
string
getItemsName()
Returns the name of the property that holds data items
in ManagesItemsTrait at line line 381
$this
setItemsName($nameOfItemsRepository)
Sets the name of the property that holds data items
in ManagesItemsTrait at line line 393
string
toJson(int $options)
Get the collection of items as JSON.
in ManagesItemsTrait at line line 402
string
__toString()
When manager instance is used as a string, return json of items
at line line 26
__construct(array $items = array())
Build a new manager instance