• Full name: \App\Infrastructure\Services\Attribute\AttributeBag
  • This class is marked as final and can't be subclassed
  • This class is a Final class

Properties

items

private array $items

Methods

__construct

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

Parameters:

Parameter Type Description
$items array

fromArray

public static fromArray(array<string,mixed> $items): self
  • This method is static. Parameters:
Parameter Type Description
$items array

fromJson

public static fromJson(?string $json = null): self
  • This method is static. Parameters:
Parameter Type Description
$json ?string

has

public has(string $key): bool

Parameters:

Parameter Type Description
$key string

get

public get(string $key, mixed $default = null): mixed

Parameters:

Parameter Type Description
$key string
$default mixed

string

public string(string $key, string $default = ''): string

Parameters:

Parameter Type Description
$key string
$default string

int

public int(string $key, int $default = 0): int

Parameters:

Parameter Type Description
$key string
$default int

float

public float(string $key, float $default = 0.0): float

Parameters:

Parameter Type Description
$key string
$default float

bool

public bool(string $key, bool $default = false): bool

Parameters:

Parameter Type Description
$key string
$default bool

array

public array(string $key, array<array-key,mixed> $default = []): array<array-key,mixed>

Parameters:

Parameter Type Description
$key string
$default array

set

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

Parameters:

Parameter Type Description
$key string
$value mixed

remove

public remove(string $key): self

Parameters:

Parameter Type Description
$key string

merge

public merge(array<string,mixed> $values): self

Parameters:

Parameter Type Description
$values array

mergeRecursive

public mergeRecursive(array<string,mixed> $values): self

Parameters:

Parameter Type Description
$values array

getPath

Dot notation access: seo.title, custom_fields.cta_text

public getPath(string $path, mixed $default = null): mixed

Parameters:

Parameter Type Description
$path string
$default mixed

setPath

public setPath(string $path, mixed $value): self

Parameters:

Parameter Type Description
$path string
$value mixed

removePath

public removePath(string $path): self

Parameters:

Parameter Type Description
$path string

toArray

public toArray(): array<string,mixed>

toJson

public toJson(): string

doMergeRecursive

private doMergeRecursive(array<string,mixed> $left, array<string,mixed> $right): array<string,mixed>

Parameters:

Parameter Type Description
$left array
$right array