| @@ 24-101 (lines=78) @@ | ||
| 21 | * |
|
| 22 | * @author Vitaliy Zhuk <[email protected]> |
|
| 23 | */ |
|
| 24 | class AfterDenormalizationEvent extends Event |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * @var mixed |
|
| 28 | */ |
|
| 29 | private $data; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @var ResourceInterface |
|
| 33 | */ |
|
| 34 | private $resource; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @var string |
|
| 38 | */ |
|
| 39 | private $format; |
|
| 40 | ||
| 41 | /** |
|
| 42 | * @var array |
|
| 43 | */ |
|
| 44 | private $context; |
|
| 45 | ||
| 46 | /** |
|
| 47 | * Constructor. |
|
| 48 | * |
|
| 49 | * @param mixed $data |
|
| 50 | * @param ResourceInterface $resource |
|
| 51 | * @param string $format |
|
| 52 | * @param array $context |
|
| 53 | */ |
|
| 54 | public function __construct($data, ResourceInterface $resource, string $format, array $context) |
|
| 55 | { |
|
| 56 | $this->data = $data; |
|
| 57 | $this->resource = $resource; |
|
| 58 | $this->format = $format; |
|
| 59 | $this->context = $context; |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * Get data |
|
| 64 | * |
|
| 65 | * @return mixed |
|
| 66 | */ |
|
| 67 | public function getData() |
|
| 68 | { |
|
| 69 | return $this->data; |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * Get denormalized resource |
|
| 74 | * |
|
| 75 | * @return ResourceInterface |
|
| 76 | */ |
|
| 77 | public function getResource(): ResourceInterface |
|
| 78 | { |
|
| 79 | return $this->resource; |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * Get format |
|
| 84 | * |
|
| 85 | * @return string |
|
| 86 | */ |
|
| 87 | public function getFormat(): string |
|
| 88 | { |
|
| 89 | return $this->format; |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * Get context |
|
| 94 | * |
|
| 95 | * @return array |
|
| 96 | */ |
|
| 97 | public function getContext(): array |
|
| 98 | { |
|
| 99 | return $this->context; |
|
| 100 | } |
|
| 101 | } |
|
| 102 | ||
| @@ 24-101 (lines=78) @@ | ||
| 21 | * |
|
| 22 | * @author Vitaliy Zhuk <[email protected]> |
|
| 23 | */ |
|
| 24 | class AfterNormalizationEvent extends Event |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * @var ResourceInterface |
|
| 28 | */ |
|
| 29 | private $resource; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @var array |
|
| 33 | */ |
|
| 34 | private $data; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @var string |
|
| 38 | */ |
|
| 39 | private $format; |
|
| 40 | ||
| 41 | /** |
|
| 42 | * @var array |
|
| 43 | */ |
|
| 44 | private $context; |
|
| 45 | ||
| 46 | /** |
|
| 47 | * Constructor. |
|
| 48 | * |
|
| 49 | * @param ResourceInterface $resource |
|
| 50 | * @param array $data |
|
| 51 | * @param string $format |
|
| 52 | * @param array $context |
|
| 53 | */ |
|
| 54 | public function __construct(ResourceInterface $resource, array $data, string $format, array $context) |
|
| 55 | { |
|
| 56 | $this->resource = $resource; |
|
| 57 | $this->data = $data; |
|
| 58 | $this->format = $format; |
|
| 59 | $this->context = $context; |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * Get resource |
|
| 64 | * |
|
| 65 | * @return ResourceInterface |
|
| 66 | */ |
|
| 67 | public function getResource(): ResourceInterface |
|
| 68 | { |
|
| 69 | return $this->resource; |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * Get the normalized data |
|
| 74 | * |
|
| 75 | * @return array |
|
| 76 | */ |
|
| 77 | public function getNormalizedData(): array |
|
| 78 | { |
|
| 79 | return $this->data; |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * Get format |
|
| 84 | * |
|
| 85 | * @return string |
|
| 86 | */ |
|
| 87 | public function getFormat(): string |
|
| 88 | { |
|
| 89 | return $this->format; |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * Get context |
|
| 94 | * |
|
| 95 | * @return array |
|
| 96 | */ |
|
| 97 | public function getContext(): array |
|
| 98 | { |
|
| 99 | return $this->context; |
|
| 100 | } |
|
| 101 | } |
|
| 102 | ||
| @@ 23-100 (lines=78) @@ | ||
| 20 | * |
|
| 21 | * @author Vitaliy Zhuk <[email protected]> |
|
| 22 | */ |
|
| 23 | class BeforeDenormalizationEvent extends Event |
|
| 24 | { |
|
| 25 | /** |
|
| 26 | * @var mixed |
|
| 27 | */ |
|
| 28 | private $data; |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @var string |
|
| 32 | */ |
|
| 33 | private $type; |
|
| 34 | ||
| 35 | /** |
|
| 36 | * @var string |
|
| 37 | */ |
|
| 38 | private $format; |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @var array |
|
| 42 | */ |
|
| 43 | private $context; |
|
| 44 | ||
| 45 | /** |
|
| 46 | * Constructor. |
|
| 47 | * |
|
| 48 | * @param mixed $data |
|
| 49 | * @param string $type |
|
| 50 | * @param string $format |
|
| 51 | * @param array $context |
|
| 52 | */ |
|
| 53 | public function __construct($data, string $type, string $format, array $context) |
|
| 54 | { |
|
| 55 | $this->data = $data; |
|
| 56 | $this->type = $type; |
|
| 57 | $this->format = $format; |
|
| 58 | $this->context = $context; |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * Get data |
|
| 63 | * |
|
| 64 | * @return mixed |
|
| 65 | */ |
|
| 66 | public function geData() |
|
| 67 | { |
|
| 68 | return $this->data; |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * Get type |
|
| 73 | * |
|
| 74 | * @return string |
|
| 75 | */ |
|
| 76 | public function getType(): string |
|
| 77 | { |
|
| 78 | return $this->type; |
|
| 79 | } |
|
| 80 | ||
| 81 | /** |
|
| 82 | * Get format |
|
| 83 | * |
|
| 84 | * @return string |
|
| 85 | */ |
|
| 86 | public function getFormat(): string |
|
| 87 | { |
|
| 88 | return $this->format; |
|
| 89 | } |
|
| 90 | ||
| 91 | /** |
|
| 92 | * Get context |
|
| 93 | * |
|
| 94 | * @return array |
|
| 95 | */ |
|
| 96 | public function getContext(): array |
|
| 97 | { |
|
| 98 | return $this->context; |
|
| 99 | } |
|
| 100 | } |
|
| 101 | ||