Completed
Push — master ( 882cbc...a9ee6a )
by
unknown
15:23
created

AttributionBasedSingleResourceDocument   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 24
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getJsonApi() 0 4 1
A getMeta() 0 4 1
A getLinks() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace hiapi\jsonApi;
5
6
use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractCollectionDocument;
7
use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractSingleResourceDocument;
8
use WoohooLabs\Yin\JsonApi\Schema\JsonApiObject;
9
use WoohooLabs\Yin\JsonApi\Schema\Link\DocumentLinks;
10
11
/**
12
 * Allows easy creation of JSON:API documents class.
13
 * `attributionClass` can be provided or it will be found automatically
14
 * by class name in the same directory, see `findAttributionClass`.
15
 *
16
 * @author Andrii Vasyliev <[email protected]>
17
 */
18
class AttributionBasedSingleResourceDocument extends AbstractSingleResourceDocument
19
{
20
    public function __construct(AttributionBasedResourceFinder $resourceFinder)
21
    {
22
        $resource = $resourceFinder->getResource(static::class);
23
24
        parent::__construct($resource);
25
    }
26
27
    public function getJsonApi(): ?JsonApiObject
28
    {
29
        return new JsonApiObject('1.1');
30
    }
31
32
    public function getMeta(): array
33
    {
34
        return [];
35
    }
36
37
    public function getLinks(): ?DocumentLinks
38
    {
39
        return null;
40
    }
41
}
42