RelationshipDataIsNull   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 69
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0
wmc 8
lcom 0
cbo 1

8 Methods

Rating   Name   Duplication   Size   Complexity  
A isCollection() 0 4 1
A isNull() 0 4 1
A isResource() 0 4 1
A isIdentifier() 0 4 1
A getIdentifier() 0 4 1
A getIdentifiers() 0 4 1
A getResource() 0 4 1
A getResources() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Neomerx\JsonApi\Parser\RelationshipData;
4
5
/**
6
 * Copyright 2015-2020 [email protected]
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 * http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
21
use Neomerx\JsonApi\Contracts\Parser\IdentifierInterface;
22
use Neomerx\JsonApi\Contracts\Parser\RelationshipDataInterface;
23
use Neomerx\JsonApi\Contracts\Parser\ResourceInterface;
24
use Neomerx\JsonApi\Exceptions\LogicException;
25
use function Neomerx\JsonApi\I18n\format as _;
26
27
/**
28
 * @package Neomerx\JsonApi
29
 */
30
class RelationshipDataIsNull implements RelationshipDataInterface
31
{
32
    /** @var string */
33
    public const MSG_INVALID_OPERATION = 'Invalid operation.';
34
35
    /**
36
     * @inheritdoc
37
     */
38 6
    public function isCollection(): bool
39
    {
40 6
        return false;
41
    }
42
43
    /**
44
     * @inheritdoc
45
     */
46 6
    public function isNull(): bool
47
    {
48 6
        return true;
49
    }
50
51
    /**
52
     * @inheritdoc
53
     */
54 6
    public function isResource(): bool
55
    {
56 6
        return false;
57
    }
58
59
    /**
60
     * @inheritdoc
61
     */
62 6
    public function isIdentifier(): bool
63
    {
64 6
        return false;
65
    }
66
67
    /**
68
     * @inheritdoc
69
     */
70 1
    public function getIdentifier(): IdentifierInterface
71
    {
72 1
        throw new LogicException(_(static::MSG_INVALID_OPERATION));
73
    }
74
75
    /**
76
     * @inheritdoc
77
     */
78 1
    public function getIdentifiers(): iterable
79
    {
80 1
        throw new LogicException(_(static::MSG_INVALID_OPERATION));
81
    }
82
83
    /**
84
     * @inheritdoc
85
     */
86 1
    public function getResource(): ResourceInterface
87
    {
88 1
        throw new LogicException(_(static::MSG_INVALID_OPERATION));
89
    }
90
91
    /**
92
     * @inheritdoc
93
     */
94 1
    public function getResources(): iterable
95
    {
96 1
        throw new LogicException(_(static::MSG_INVALID_OPERATION));
97
    }
98
}
99