wol-soft/php-workflow

View on GitHub
src/State/WorkflowContainer.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

declare(strict_types=1);

namespace PHPWorkflow\State;

class WorkflowContainer
{
    protected array $items = [];

    public function get(string $key)
    {
        return $this->items[$key] ?? null;
    }

    public function set(string $key, $value): self
    {
        $this->items[$key] = $value;
        return $this;
    }

    public function unset(string $key): self
    {
        unset($this->items[$key]);
        return $this;
    }

    public function has(string $key): bool
    {
        return array_key_exists($key, $this->items);
    }
}