1 | <?php |
||
14 | class LinkHandler implements HandlerInterface |
||
15 | { |
||
16 | /** |
||
17 | * Provider of links' repositories |
||
18 | * |
||
19 | * @var LinkRepositoryProvider |
||
20 | */ |
||
21 | protected $provider; |
||
22 | |||
23 | /** |
||
24 | * Property accessor |
||
25 | * |
||
26 | * @var PropertyAccessorInterface |
||
27 | */ |
||
28 | protected $accessor; |
||
29 | |||
30 | /** |
||
31 | * LinkHandler constructor. |
||
32 | * |
||
33 | * @param LinkRepositoryProvider $provider |
||
34 | * @param PropertyAccessorInterface $accessor |
||
35 | */ |
||
36 | 1 | public function __construct(LinkRepositoryProvider $provider, PropertyAccessorInterface $accessor) |
|
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | 1 | public function toResource($object, ResourceObject $resource, MappingContext $context) |
|
63 | |||
64 | /** |
||
65 | * Create link-object |
||
66 | * |
||
67 | * @param LinkDefinition $definition |
||
68 | * @param LinkData $data |
||
69 | * @return LinkObject |
||
70 | */ |
||
71 | 1 | protected function createLink(LinkDefinition $definition, LinkData $data): LinkObject |
|
82 | |||
83 | /** |
||
84 | * Resolve parameters |
||
85 | * |
||
86 | * @param mixed $object |
||
87 | * @param LinkDefinition $definition |
||
88 | * @return array |
||
89 | */ |
||
90 | 1 | protected function resolveParameters($object, LinkDefinition $definition): array |
|
106 | |||
107 | /** |
||
108 | * {@inheritdoc} |
||
109 | */ |
||
110 | public function fromResource($object, ResourceObject $resource, MappingContext $context) |
||
114 | } |