Interfaces
2 years ago
Job
2 years ago
Service
2 years ago
Task
2 years ago
Traits
2 years ago
AbstractDto.php
3 years ago
AbstractTaskDto.php
2 years ago
JobDataDto.php
2 years ago
StepsDto.php
2 years ago
TaskResponseDto.php
2 years ago
AbstractDto.php
55 lines
| 1 | <?php |
| 2 | |
| 3 | // TODO PHP7.x declare(strict_types=1); |
| 4 | // TODO PHP7.x type-hints & return types |
| 5 | |
| 6 | namespace WPStaging\Backup\Dto; |
| 7 | |
| 8 | use JsonSerializable; |
| 9 | use Serializable; |
| 10 | use WPStaging\Framework\Interfaces\ArrayableInterface; |
| 11 | use WPStaging\Framework\Traits\ArrayableTrait; |
| 12 | use WPStaging\Framework\Traits\HydrateTrait; |
| 13 | |
| 14 | abstract class AbstractDto implements JsonSerializable, Serializable, ArrayableInterface |
| 15 | { |
| 16 | use ArrayableTrait; |
| 17 | use HydrateTrait; |
| 18 | |
| 19 | /** |
| 20 | * @inheritDoc |
| 21 | */ |
| 22 | public function serialize() |
| 23 | { |
| 24 | return serialize($this->toArray()); |
| 25 | } |
| 26 | |
| 27 | public function __serialize() |
| 28 | { |
| 29 | return $this->toArray(); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * @inheritDoc |
| 34 | */ |
| 35 | public function unserialize($serialized) |
| 36 | { |
| 37 | $this->hydrate(unserialize($serialized)); |
| 38 | } |
| 39 | |
| 40 | public function __unserialize($serialized) |
| 41 | { |
| 42 | return $this->hydrate($serialized); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * @inheritDoc |
| 47 | * |
| 48 | */ |
| 49 | #[\ReturnTypeWillChange] |
| 50 | public function jsonSerialize() |
| 51 | { |
| 52 | return $this->toArray(); |
| 53 | } |
| 54 | } |
| 55 |