-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathResource.php
79 lines (63 loc) · 1.91 KB
/
Resource.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
declare(strict_types=1);
namespace Undabot\JsonApi\Implementation\Model\Resource;
use Undabot\JsonApi\Definition\Model\Link\LinkInterface;
use Undabot\JsonApi\Definition\Model\Meta\MetaInterface;
use Undabot\JsonApi\Definition\Model\Resource\Attribute\AttributeCollectionInterface;
use Undabot\JsonApi\Definition\Model\Resource\Relationship\RelationshipCollectionInterface;
use Undabot\JsonApi\Definition\Model\Resource\ResourceInterface;
/** @psalm-suppress UnusedClass */
class Resource implements ResourceInterface
{
/** @var string */
private $id;
/** @var string */
private $type;
/** @var null|AttributeCollectionInterface */
private $attributes;
/** @var null|RelationshipCollectionInterface */
private $relationships;
/** @var null|LinkInterface */
private $selfLink;
/** @var null|MetaInterface */
private $meta;
public function __construct(
string $id,
string $type,
?AttributeCollectionInterface $attributes = null,
?RelationshipCollectionInterface $relationships = null,
?LinkInterface $selfLink = null,
?MetaInterface $meta = null
) {
$this->id = $id;
$this->type = $type;
$this->attributes = $attributes;
$this->relationships = $relationships;
$this->selfLink = $selfLink;
$this->meta = $meta;
}
public function getId(): string
{
return $this->id;
}
public function getType(): string
{
return $this->type;
}
public function getAttributes(): ?AttributeCollectionInterface
{
return $this->attributes;
}
public function getRelationships(): ?RelationshipCollectionInterface
{
return $this->relationships;
}
public function getSelfUrl(): ?LinkInterface
{
return $this->selfLink;
}
public function getMeta(): ?MetaInterface
{
return $this->meta;
}
}