46 lines
1016 B
PHP
46 lines
1016 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace KTXF\Resource\Delta;
|
|
|
|
use KTXF\Json\JsonSerializable;
|
|
|
|
class Delta implements JsonSerializable {
|
|
|
|
public function __construct(
|
|
public ?DeltaCollection $additions = null,
|
|
public ?DeltaCollection $modifications = null,
|
|
public ?DeltaCollection $deletions = null,
|
|
public ?string $signature = null,
|
|
) {
|
|
if ($this->additions === null) {
|
|
$this->additions = new DeltaCollection;
|
|
}
|
|
if ($this->modifications === null) {
|
|
$this->modifications = new DeltaCollection;
|
|
}
|
|
if ($this->deletions === null) {
|
|
$this->deletions = new DeltaCollection;
|
|
}
|
|
if ($this->signature === null) {
|
|
$this->signature = '';
|
|
}
|
|
}
|
|
|
|
public function jsonSerialize(): array {
|
|
return [
|
|
'signature' => $this->signature,
|
|
'additions' => $this->additions,
|
|
'modifications' => $this->modifications,
|
|
'deletions' => $this->deletions,
|
|
];
|
|
}
|
|
|
|
}
|