Completed
Push — master ( 0ddb86...17d161 )
by Dmitry
14:45
created

NewResourceCreatedDocument::getLinks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace hiapi\jsonApi;
4
5
use WoohooLabs\Yin\JsonApi\Document\AbstractSuccessfulDocument;
6
use WoohooLabs\Yin\JsonApi\Schema\Data\DataInterface;
7
use WoohooLabs\Yin\JsonApi\Schema\Data\SingleResourceData;
8
use WoohooLabs\Yin\JsonApi\Schema\Links;
9
use WoohooLabs\Yin\JsonApi\Schema\Resource\ResourceInterface;
10
use WoohooLabs\Yin\JsonApi\Transformer\Transformation;
11
12
/**
13
 * Class NewResourceCreatedDocument satisfies Yin 3.1
14
 *
15
 * @deprecated TEMP, TO BE DROPPED. DO NOT USE!
16
 * @author Dmytro Naumenko <[email protected]>
17
 */
18
class NewResourceCreatedDocument extends AbstractSuccessfulDocument
19
{
20
    use JsonApiObjectProviderTrait;
21
22
    /**
23
     * @var ResourceInterface
24
     */
25
    protected $transformer;
26
27
    public function __construct(ResourceInterface $transformer)
28
    {
29
        $this->transformer = $transformer;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function getMeta(): array
36
    {
37
        return [];
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function getLinks(): ?Links
44
    {
45
        return null;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    protected function createData(): DataInterface
52
    {
53
        return new SingleResourceData();
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    protected function fillData(Transformation $transformation): void
60
    {
61
        $transformation->data->addPrimaryResource($this->transformer->transformToResource($transformation, $this->domainObject));
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67
    protected function getRelationshipMember(
68
        string $relationshipName,
69
        Transformation $transformation,
70
        array $additionalMeta = []
71
    ): ?array {
72
        return null;
73
    }
74
}
75