Skip to content

ObjectStorageMap


  • Full name: \Qubus\Support\Container\ObjectStorageMap
  • This class implements: ContainerInterface, ArrayAccess, Countable, IteratorAggregate

Properties

items

private array $items

factories

private \SplObjectStorage $factories

protected

private \SplObjectStorage $protected

frozen

private array $frozen

raw

private array $raw

keys

private array $keys

Methods

__construct

public __construct(array<string,mixed> $items = []): mixed

Parameters:

Parameter Type Description
$items array Pre-populate set with this key-value array

set

Set data key to value.

public set(string $key, mixed $value): void

Parameters:

Parameter Type Description
$key string The data key
$value mixed The data value

get

Get data value with key.

public get(string $key): mixed

Parameters:

Parameter Type Description
$key string The data key

Return Value:

The data value.

Throws:


replace

Add data to set.

public replace(array<string,mixed> $items): void

Parameters:

Parameter Type Description
$items array Key-value array of data to append to this set

all

Fetch set data.

public all(): array

keys

Fetch set data keys.

public keys(): list<\Qubus\Support\Container\TKey>

Return Value:

This set's key-value data array keys


has

Does this set contain a key?

public has(string $key): bool

Parameters:

Parameter Type Description
$key string The data key

remove

Remove value with key from this set.

public remove(string $key): void

Parameters:

Parameter Type Description
$key string The data key

__get

public __get(string $key): mixed

Parameters:

Parameter Type Description
$key string The data key.

Throws:


__set

public __set(string $key, mixed $value): mixed

Parameters:

Parameter Type Description
$key string The data key
$value mixed The data value

__isset

public __isset(string $key): bool

Parameters:

Parameter Type Description
$key string The data key

__unset

public __unset(string $key): mixed

Parameters:

Parameter Type Description
$key string The data key

clear

Clear all items.

public clear(): void

offsetExists

Array Access.

public offsetExists(\Qubus\Support\Container\TKey $offset): bool

Parameters:

Parameter Type Description
$offset \Qubus\Support\Container\TKey

offsetGet

public offsetGet(\Qubus\Support\Container\TKey $key): \Qubus\Support\Container\TValue

Parameters:

Parameter Type Description
$key \Qubus\Support\Container\TKey

Throws:


offsetSet

public offsetSet(\Qubus\Support\Container\TKey $key, \Qubus\Support\Container\TValue $value): void

Parameters:

Parameter Type Description
$key \Qubus\Support\Container\TKey
$value \Qubus\Support\Container\TValue

offsetUnset

public offsetUnset(mixed $key): void

Parameters:

Parameter Type Description
$key mixed

count

Countable

public count(): int

getIterator

IteratorAggregate

public getIterator(): \ArrayIterator<\Qubus\Support\Container\TKey,\Qubus\Support\Container\TValue>

singleton

Ensure a value or object will remain globally unique.

public singleton(string $key, callable $value): void

Parameters:

Parameter Type Description
$key string The value or object name
$value callable The closure that defines the object

factory

Marks a callable as being a factory service.

public factory(callable $callable): callable

Parameters:

Parameter Type Description
$callable callable

Throws:


protect

Protects a callable from being interpreted as a service.

public protect(callable $callable): callable

Parameters:

Parameter Type Description
$callable callable A closure to keep from being invoked and evaluated.

Throws:


raw

Gets a parameter or the closure defining an object.

public raw(string $key): mixed

Parameters:

Parameter Type Description
$key string

Throws:


extend

Extends an object definition.

public extend(string $key, callable $callable): callable

Useful when you want to extend an existing object definition, without necessarily loading that object.

Parameters:

Parameter Type Description
$key string
$callable callable

Throws:


register

Registers a service provider.

public register(\Qubus\Support\Container\ServiceProvider $provider, array $values = []): static

Parameters:

Parameter Type Description
$provider \Qubus\Support\Container\ServiceProvider A ServiceProvider instance.
$values array An array of values that customizes the provider