Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 18 |
CRAP | |
0.00% |
0 / 77 |
SupervisorProcessDataImmutable | |
0.00% |
0 / 1 |
|
0.00% |
0 / 18 |
3782 | |
0.00% |
0 / 77 |
__construct | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 17 |
|||
fromArray | |
0.00% |
0 / 1 |
272 | |
0.00% |
0 / 11 |
|||
fromIterable | |
0.00% |
0 / 1 |
182 | |
0.00% |
0 / 12 |
|||
getId | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
getState | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
getCommand | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
getCreatedAt | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
getModifiedAt | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
getMemoryLimit | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
getArgs | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
get | |
0.00% |
0 / 1 |
72 | |
0.00% |
0 / 9 |
|||
withId | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 3 |
|||
withState | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
withCommand | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
withCreatedAt | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
withModifiedAt | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
withMemoryLimit | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 3 |
|||
withArgs | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 3 |
<?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 SupervisorProcessDataImmutable 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 withId(?int $id): self | |
{ | |
$t = clone $this; | |
$t->id = $id; | |
return $t; | |
} | |
public function withState(string $state): self | |
{ | |
$t = clone $this; | |
$t->state = $state; | |
return $t; | |
} | |
public function withCommand(string $command): self | |
{ | |
$t = clone $this; | |
$t->command = $command; | |
return $t; | |
} | |
public function withCreatedAt(DateTimeImmutable $createdAt): self | |
{ | |
$t = clone $this; | |
$t->createdAt = $createdAt; | |
return $t; | |
} | |
public function withModifiedAt(DateTimeImmutable $modifiedAt): self | |
{ | |
$t = clone $this; | |
$t->modifiedAt = $modifiedAt; | |
return $t; | |
} | |
public function withMemoryLimit(?int $memoryLimit): self | |
{ | |
$t = clone $this; | |
$t->memoryLimit = $memoryLimit; | |
return $t; | |
} | |
public function withArgs(?array $args): self | |
{ | |
$t = clone $this; | |
$t->args = $args; | |
return $t; | |
} | |
} | |