1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the G.L.S.R. Apps package. |
7
|
|
|
* |
8
|
|
|
* (c) Dev-Int Création <[email protected]>. |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Administration\Infrastructure\Supplier\Serializer\Handler; |
15
|
|
|
|
16
|
|
|
use Administration\Application\Supplier\ReadModel\Supplier; |
17
|
|
|
use JMS\Serializer\GraphNavigator; |
|
|
|
|
18
|
|
|
use JMS\Serializer\Handler\SubscribingHandlerInterface; |
|
|
|
|
19
|
|
|
use JMS\Serializer\JsonDeserializationVisitor; |
|
|
|
|
20
|
|
|
use JMS\Serializer\JsonSerializationVisitor; |
|
|
|
|
21
|
|
|
|
22
|
|
|
class SupplierHandler implements SubscribingHandlerInterface |
23
|
|
|
{ |
24
|
|
|
public static function getSubscribingMethods(): array |
25
|
|
|
{ |
26
|
|
|
return [ |
27
|
|
|
[ |
28
|
|
|
'direction' => GraphNavigator::DIRECTION_SERIALIZATION, |
29
|
|
|
'format' => 'json', |
30
|
|
|
'type' => Supplier::class, |
31
|
|
|
'method' => 'serialize', |
32
|
|
|
], |
33
|
|
|
[ |
34
|
|
|
'direction' => GraphNavigator::DIRECTION_DESERIALIZATION, |
35
|
|
|
'format' => 'json', |
36
|
|
|
'type' => Supplier::class, |
37
|
|
|
'method' => 'deserialize', |
38
|
|
|
], |
39
|
|
|
]; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function serialize(JsonSerializationVisitor $visitor, Supplier $supplier, array $type): array |
43
|
|
|
{ |
44
|
|
|
$data = [ |
45
|
|
|
'uuid' => $supplier->uuid(), |
46
|
|
|
'name' => $supplier->name(), |
47
|
|
|
'address' => $supplier->address(), |
48
|
|
|
'zipCode' => $supplier->zipCode(), |
49
|
|
|
'town' => $supplier->town(), |
50
|
|
|
'country' => $supplier->country(), |
51
|
|
|
'phone' => $supplier->phone(), |
52
|
|
|
'facsimile' => $supplier->facsimile(), |
53
|
|
|
'email' => $supplier->email(), |
54
|
|
|
'contact' => $supplier->contact(), |
55
|
|
|
'cellphone' => $supplier->cellphone(), |
56
|
|
|
'familyLog' => $supplier->familyLog(), |
57
|
|
|
'delayDelivery' => $supplier->delayDelivery(), |
58
|
|
|
'orderDays' => $supplier->orderDays(), |
59
|
|
|
'slug' => $supplier->slug(), |
60
|
|
|
]; |
61
|
|
|
|
62
|
|
|
return $visitor->visitArray($data, $type); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function deserialize(JsonDeserializationVisitor $visitor, array $data): Supplier |
66
|
|
|
{ |
67
|
|
|
return new Supplier( |
68
|
|
|
$data['uuid'], |
69
|
|
|
$data['name'], |
70
|
|
|
$data['address'], |
71
|
|
|
$data['zipCode'], |
72
|
|
|
$data['town'], |
73
|
|
|
$data['country'], |
74
|
|
|
$data['phone'], |
75
|
|
|
$data['facsimile'], |
76
|
|
|
$data['email'], |
77
|
|
|
$data['contact'], |
78
|
|
|
$data['cellphone'], |
79
|
|
|
$data['familyLog'], |
80
|
|
|
$data['delayDelivery'], |
81
|
|
|
$data['orderDays'], |
82
|
|
|
$data['slug'], |
83
|
|
|
); |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths