generated from wayofdev/laravel-package-tpl
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSerializerInterface.php
41 lines (28 loc) · 1.37 KB
/
SerializerInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
declare(strict_types=1);
namespace WayOfDev\Serializer\Contracts;
use ArrayObject;
use Stringable;
use Symfony\Component\Serializer\Exception\ExceptionInterface;
interface SerializerInterface
{
public function serialize(mixed $payload): string|Stringable;
public function unserialize(string|Stringable $payload, string|object $type = null): mixed;
/**
* @param mixed $data
* @param string|null $format
* @param array $context
*
* @throws ExceptionInterface
*
* @return array|string|int|float|bool|ArrayObject|null
*/
public function normalize(mixed $data, string $format = null, array $context = []): array | string | int | float | bool | ArrayObject | null;
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed;
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool;
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool;
public function encode(mixed $data, string $format, array $context = []);
public function decode(string $data, string $format, array $context = []);
public function supportsEncoding(string $format, array $context = []): bool;
public function supportsDecoding(string $format, array $context = []): bool;
}