Completed
Branch master (726023)
by
unknown
02:44
created

getRelationshipRelatedLink()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 4
crap 1
1
<?php namespace Neomerx\JsonApi\Schema;
2
3
/**
4
 * Copyright 2015 [email protected] (www.neomerx.com)
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 * http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
use \EmptyIterator;
20
use \Neomerx\JsonApi\Contracts\Factories\FactoryInterface;
21
use \Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface;
22
23
/**
24
 * @package Neomerx\JsonApi
25
 */
26
class ResourceIdentifierSchemaAdapter implements SchemaProviderInterface
27
{
28
    /**
29
     * @var SchemaProviderInterface
30
     */
31
    private $schema;
32
33
    /**
34
     * @var FactoryInterface
35
     */
36
    private $factory;
37
38
    /**
39
     * @param FactoryInterface        $factory
40
     * @param SchemaProviderInterface $schema
41
     */
42 3
    public function __construct(FactoryInterface $factory, SchemaProviderInterface $schema)
43
    {
44 3
        $this->schema  = $schema;
45 3
        $this->factory = $factory;
46 3
    }
47
48
    /**
49
     * @inheritdoc
50
     */
51 2
    public function getResourceType()
52
    {
53 2
        return $this->schema->getResourceType();
54
    }
55
56
    /**
57
     * @inheritdoc
58
     */
59 1
    public function getSelfSubUrl($resource = null)
60
    {
61 1
        return $this->schema->getSelfSubUrl($resource);
62
    }
63
64
    /**
65
     * @inheritdoc
66
     */
67 2
    public function getId($resource)
68
    {
69 2
        return $this->schema->getId($resource);
70
    }
71
72
    /**
73
     * @inheritdoc
74
     */
75 1
    public function getSelfSubLink($resource)
76
    {
77 1
        return $this->schema->getSelfSubLink($resource);
78
    }
79
80
    /**
81
     * @inheritdoc
82
     */
83 3
    public function getAttributes($resource)
84
    {
85 3
        return [];
86
    }
87
88
    /**
89
     * @inheritdoc
90
     */
91 2
    public function createResourceObject($resource, $isOriginallyArrayed, $attributeKeysFilter = null)
92
    {
93 2
        $attributeKeysFilter = [];
94 2
        return $this->factory->createResourceObject($this, $resource, $isOriginallyArrayed, $attributeKeysFilter);
95
    }
96
97
    /**
98
     * @inheritdoc
99
     */
100 3
    public function getRelationshipObjectIterator($resource, $isPrimary, array $includeRelationships)
101
    {
102 3
        return new EmptyIterator();
103
    }
104
105
    /**
106
     * @inheritdoc
107
     */
108 3
    public function getResourceLinks($resource)
109
    {
110 3
        return [];
111
    }
112
113
    /**
114
     * @inheritdoc
115
     */
116 1
    public function getIncludedResourceLinks($resource)
117
    {
118 1
        return [];
119
    }
120
121
    /**
122
     * @inheritdoc
123
     */
124 1
    public function isShowAttributesInIncluded()
125
    {
126 1
        return false;
127
    }
128
129
    /**
130
     * @inheritdoc
131
     */
132 1
    public function isShowRelationshipsInIncluded()
133
    {
134 1
        return false;
135
    }
136
137
    /**
138
     * @inheritdoc
139
     */
140 3
    public function getIncludePaths()
141
    {
142 3
        return [];
143
    }
144
145
    /**
146
     * @inheritdoc
147
     */
148 3
    public function getPrimaryMeta($resource)
149
    {
150 3
        return $this->schema->getPrimaryMeta($resource);
151
    }
152
153
    /**
154
     * @inheritdoc
155
     */
156 1
    public function getInclusionMeta($resource)
157
    {
158 1
        return null;
159
    }
160
161
    /**
162
     * @inheritdoc
163
     */
164 1
    public function getRelationshipsPrimaryMeta($resource)
165
    {
166 1
        return null;
167
    }
168
169
    /**
170
     * @inheritdoc
171
     */
172 1
    public function getRelationshipsInclusionMeta($resource)
173
    {
174 1
        return null;
175
    }
176
177
    /**
178
     * @inheritdoc
179
     */
180 1
    public function getLinkageMeta($resource)
181
    {
182 1
        return $this->schema->getLinkageMeta($resource);
183
    }
184
185
    /**
186
     * @inheritdoc
187
     */
188 1
    public function getRelationshipSelfLink($resource, $name, $meta = null, $treatAsHref = false)
189
    {
190 1
        return $this->schema->getRelationshipSelfLink($resource, $name, $meta, $treatAsHref);
191
    }
192
193
    /**
194
     * @inheritdoc
195
     */
196 1
    public function getRelationshipRelatedLink($resource, $name, $meta = null, $treatAsHref = false)
197
    {
198 1
        return $this->schema->getRelationshipRelatedLink($resource, $name, $meta, $treatAsHref);
199
    }
200
}
201