IocManager
class IocManager implements ManagesItemsInterface, ContainerInterface, IocManagerInterface
Manages deeply nested, complex data.
This concrete class implements ManagesItems and ChainsNestedItems as well as Container interoperability and various array functionality.
Traits
Methods
Initializes a new manager instance.
Hydrate with external data, optionally append
Adds a single item.
Push a value or values onto the end of an array inside manager
Get a single item
Get a single item
Return an item if it exist Alias of getIfExists()
Confirm or deny that an item exists Alias of exists()
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
Alias of get() for backwards comparability
Build a new manager instance
Details
in DependsOnManagesItemsTrait at line line 15
abstract $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 DependsOnManagesItemsTrait at line line 24
abstract $this
hydrate($data, bool $append = false)
Hydrate with external data, optionally append
in DependsOnManagesItemsTrait at line line 36
abstract $this
add(string $alias, mixed $item = null, array $options = null)
Adds a single item.
Allow for dot notation (one.two.three) and item nesting.
in DependsOnManagesItemsTrait at line line 46
abstract $this
set(string $alias, null $item = null)
Updates an item
in DependsOnManagesItemsTrait at line line 56
abstract int
push(string $alias, mixed $value, null|mixed $other = null)
Push a value or values onto the end of an array inside manager
in DependsOnManagesItemsTrait at line line 66
abstract mixed
get(string $alias, string $fallback = '_michaels_no_fallback')
Get a single item
in ManagesItemsTrait at line line 214
mixed
getRaw(string $alias, string $fallback = '_michaels_no_fallback')
Get a single item
in DependsOnManagesItemsTrait at line line 73
abstract NoItemFoundMessage
getIfExists($alias)
Return an item if it exist
in DependsOnManagesItemsTrait at line line 82
abstract NoItemFoundMessage
getIfHas($alias)
Return an item if it exist Alias of getIfExists()
in DependsOnManagesItemsTrait at line line 89
abstract array
getAll()
Return all items as array
in DependsOnManagesItemsTrait at line line 96
abstract array
all()
Return all items as array Alias of getAll()
in DependsOnManagesItemsTrait at line line 104
abstract bool
exists($alias)
Confirm or deny that an item exists
in DependsOnManagesItemsTrait at line line 113
abstract bool
has($alias)
Confirm or deny that an item exists Alias of exists()
in DependsOnManagesItemsTrait at line line 119
abstract boolean
isEmpty()
Confirm that manager has no items
in DependsOnManagesItemsTrait at line line 127
abstract $this
remove($alias)
Deletes an item
in DependsOnManagesItemsTrait at line line 133
abstract $this
clear()
Clear the manager
in DependsOnManagesItemsTrait at line line 142
abstract mixed
reset(array $items)
Reset the manager with an array of items Alias of initManager()
in ManagesItemsTrait at line line 376
$this
protect($item)
Guard an alias from being modified
in ManagesItemsTrait at line line 387
$this
loadDefaults(array $defaults)
Merge a set of defaults with the current items
in ManagesItemsTrait at line line 397
string
getItemsName()
Returns the name of the property that holds data items
in ManagesItemsTrait at line line 407
$this
setItemsName($nameOfItemsRepository)
Sets the name of the property that holds data items
in DependsOnManagesItemsTrait at line line 150
abstract string
toJson(int $options)
Get the collection of items as JSON.
in DependsOnManagesItemsTrait at line line 156
abstract string
__toString()
When manager instance is used as a string, return json of items
in ManagesIocTrait at line line 69
mixed
fetch(string $alias, string|mixed $fallback = '_michaels_no_fallback')
Alias of get() for backwards comparability
in ManagesIocTrait at line line 118
mixed
share($alias)
Turns a dependency into a singleton.
in ManagesIocTrait at line line 130
$this
setup($alias, $pipeline)
Add a pipeline to to the que
at line line 29
__construct(array $items = array())
Build a new manager instance