Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 18
CRAP
0.00% covered (danger)
0.00%
0 / 70
SupervisorProcessDataMutable
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 18
3782
0.00% covered (danger)
0.00%
0 / 70
 __construct
0.00% covered (danger)
0.00%
0 / 1
20
0.00% covered (danger)
0.00%
0 / 17
 fromArray
0.00% covered (danger)
0.00%
0 / 1
272
0.00% covered (danger)
0.00%
0 / 11
 fromIterable
0.00% covered (danger)
0.00%
0 / 1
182
0.00% covered (danger)
0.00%
0 / 12
 getId
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 getState
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 getCommand
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 getCreatedAt
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 getModifiedAt
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 getMemoryLimit
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 getArgs
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 get
0.00% covered (danger)
0.00%
0 / 1
72
0.00% covered (danger)
0.00%
0 / 9
 setId
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 2
 setState
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setCommand
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setCreatedAt
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setModifiedAt
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setMemoryLimit
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 2
 setArgs
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 2
<?php declare(strict_types = 1);
//
// Generated by Smalldb\CodeCooker\Generator\DtoGenerator.
// Do NOT edit! All changes will be lost!
// 
// 
namespace Smalldb\StateMachine\Test\Example\SupervisorProcess\SupervisorProcessData;
use DateTimeImmutable;
use InvalidArgumentException;
use Smalldb\CodeCooker\Annotation\GeneratedClass;
use Smalldb\StateMachine\Test\Example\SupervisorProcess\SupervisorProcessProperties as Source_SupervisorProcessProperties;
/**
 * @GeneratedClass
 * @see \Smalldb\StateMachine\Test\Example\SupervisorProcess\SupervisorProcessProperties
 */
class SupervisorProcessDataMutable extends Source_SupervisorProcessProperties implements SupervisorProcessData
{
    public function __construct(?SupervisorProcessData $source = null)
    {
        if ($source !== null) {
            if ($source instanceof Source_SupervisorProcessProperties) {
                $this->id = $source->id;
                $this->state = $source->state;
                $this->command = $source->command;
                $this->createdAt = $source->createdAt;
                $this->modifiedAt = $source->modifiedAt;
                $this->memoryLimit = $source->memoryLimit;
                $this->args = $source->args;
            } else {
                $this->id = $source->getId();
                $this->state = $source->getState();
                $this->command = $source->getCommand();
                $this->createdAt = $source->getCreatedAt();
                $this->modifiedAt = $source->getModifiedAt();
                $this->memoryLimit = $source->getMemoryLimit();
                $this->args = $source->getArgs();
            }
        }
    }
    public static function fromArray(?array $source, ?SupervisorProcessData $sourceObj = null): ?self
    {
        if ($source === null) {
            return null;
        }
        $t = $sourceObj instanceof self ? clone $sourceObj : new self($sourceObj);
        $t->id = isset($source['id']) ? (int) $source['id'] : null;
        $t->state = (string) $source['state'];
        $t->command = (string) $source['command'];
        $t->createdAt = ($v = $source['createdAt'] ?? null) instanceof \DateTimeImmutable || $v === null ? $v : ($v instanceof \DateTime ? \DateTimeImmutable::createFromMutable($v) : new \DateTimeImmutable($v));
        $t->modifiedAt = ($v = $source['modifiedAt'] ?? null) instanceof \DateTimeImmutable || $v === null ? $v : ($v instanceof \DateTime ? \DateTimeImmutable::createFromMutable($v) : new \DateTimeImmutable($v));
        $t->memoryLimit = isset($source['memoryLimit']) ? (int) $source['memoryLimit'] : null;
        $t->args = isset($source['args']) ? (is_string($source['args']) ? json_decode($source['args'], TRUE) : $source['args']) : null;
        return $t;
    }
    public static function fromIterable(?SupervisorProcessData $sourceObj, iterable $source): self
    {
        $t = $sourceObj instanceof self ? clone $sourceObj : new self($sourceObj);
        foreach ($source as $prop => $value) {
            switch ($prop) {
                case 'id': $t->id = $value; break;
                case 'state': $t->state = $value; break;
                case 'command': $t->command = $value; break;
                case 'createdAt': $t->createdAt = $value instanceof \DateTime ? \DateTimeImmutable::createFromMutable($value) : $value; break;
                case 'modifiedAt': $t->modifiedAt = $value instanceof \DateTime ? \DateTimeImmutable::createFromMutable($value) : $value; break;
                case 'memoryLimit': $t->memoryLimit = $value; break;
                case 'args': $t->args = $value; break;
                default: throw new InvalidArgumentException('Unknown property: "' . $prop . '" not in ' . __CLASS__);
            }
        }
        return $t;
    }
    public function getId(): ?int
    {
        return $this->id;
    }
    public function getState(): string
    {
        return $this->state;
    }
    public function getCommand(): string
    {
        return $this->command;
    }
    public function getCreatedAt(): DateTimeImmutable
    {
        return $this->createdAt;
    }
    public function getModifiedAt(): DateTimeImmutable
    {
        return $this->modifiedAt;
    }
    public function getMemoryLimit(): ?int
    {
        return $this->memoryLimit;
    }
    public function getArgs(): ?array
    {
        return $this->args;
    }
    public static function get(SupervisorProcessData $source, string $propertyName)
    {
        switch ($propertyName) {
            case 'id': return $source->getId();
            case 'state': return $source->getState();
            case 'command': return $source->getCommand();
            case 'createdAt': return $source->getCreatedAt();
            case 'modifiedAt': return $source->getModifiedAt();
            case 'memoryLimit': return $source->getMemoryLimit();
            case 'args': return $source->getArgs();
            default: throw new \InvalidArgumentException("Unknown property: " . $propertyName);
        }
    }
    public function setId(?int $id): void
    {
        $this->id = $id;
    }
    public function setState(string $state): void
    {
        $this->state = $state;
    }
    public function setCommand(string $command): void
    {
        $this->command = $command;
    }
    public function setCreatedAt(DateTimeImmutable $createdAt): void
    {
        $this->createdAt = $createdAt;
    }
    public function setModifiedAt(DateTimeImmutable $modifiedAt): void
    {
        $this->modifiedAt = $modifiedAt;
    }
    public function setMemoryLimit(?int $memoryLimit): void
    {
        $this->memoryLimit = $memoryLimit;
    }
    public function setArgs(?array $args): void
    {
        $this->args = $args;
    }
}