ManagesIocTrait
trait ManagesIocTrait
Manages complex, nested data
Traits
Methods
Initializes a new manager instance.
Hydrate with external data, optionally append
Adds a dependency to the manager
Push a value or values onto the end of an array inside manager
Returns the request object with all dependencies
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()
When manager instance is used as a string, return json of items
Alias of get() for backwards comparability
Turns a dependency into a singleton.
Add a pipeline to to the que
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
at line line 87
$this
add(string $alias, callable|string|object $factory = null, array $declared = null)
Adds a dependency to the manager
$factory can be a: string Full class name for a new object each time callable Factory to create new object (passed manager) object The exact object to be returned
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
at line line 33
mixed
get(string $alias, string|mixed $fallback = '_michaels_no_fallback')
Returns the request object with all dependencies
Overrides the get()
method on ManagesItemsTrait
Use getRaw() to return the raw value
string Full class name for a new object each time callable Factory to create new object (passed manager) object The exact object to be returned
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 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
at line line 69
mixed
fetch(string $alias, string|mixed $fallback = '_michaels_no_fallback')
Alias of get() for backwards comparability
at line line 118
mixed
share($alias)
Turns a dependency into a singleton.
at line line 130
$this
setup($alias, $pipeline)
Add a pipeline to to the que