GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Relationship::getTarget()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 10
loc 10
ccs 0
cts 6
cp 0
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
1
<?php
2
namespace Dkd\PhpCmis\DataObjects;
3
4
/*
5
 * This file is part of php-cmis-client.
6
 *
7
 * (c) Sascha Egerer <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
use Dkd\PhpCmis\CmisObject\CmisObjectInterface;
14
use Dkd\PhpCmis\Data\ObjectIdInterface;
15
use Dkd\PhpCmis\Data\RelationshipInterface;
16
use Dkd\PhpCmis\OperationContextInterface;
17
use Dkd\PhpCmis\PropertyIds;
18
19
/**
20
 * Cmis Relationship implementation
21
 */
22
class Relationship extends AbstractFileableCmisObject implements RelationshipInterface
23
{
24
    /**
25
     * Gets the source object using the given OperationContext.
26
     *
27
     * @param OperationContextInterface|null $context
28
     * @return CmisObjectInterface|null If the source object ID is invalid, <code>null</code> will be returned.
29
     */
30 View Code Duplication
    public function getSource(OperationContextInterface $context = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
    {
32
        $sourceId = $this->getSourceId();
33
        if ($sourceId === null) {
34
            return null;
35
        }
36
        $context = $this->ensureContext($context);
37
38
        return $this->getSession()->getObject($sourceId, $context);
39
    }
40
41
    /**
42
     * Gets the target object using the given OperationContext.
43
     *
44
     * @param OperationContextInterface|null $context
45
     * @return CmisObjectInterface If the target object ID is invalid, <code>null</code> will be returned.
46
     */
47 View Code Duplication
    public function getTarget(OperationContextInterface $context = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
48
    {
49
        $context = $this->ensureContext($context);
50
        $targetId = $this->getTargetId();
51
        if ($targetId === null) {
52
            return null;
53
        }
54
55
        return $this->getSession()->getObject($targetId, $context);
56
    }
57
58
    /**
59
     * Returns the source ID of this CMIS relationship (CMIS property cmis:sourceId).
60
     *
61
     * @return ObjectIdInterface|null the source ID or <code>null</code> if the property hasn't been requested,
62
     * hasn't been provided by the repository, or the property value isn't set
63
     */
64 View Code Duplication
    public function getSourceId()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
65
    {
66
        $sourceId = $this->getPropertyValue(PropertyIds::SOURCE_ID);
67
        if (empty($sourceId)) {
68
            return null;
69
        }
70
71
        return $this->getSession()->createObjectId($sourceId);
72
    }
73
74
    /**
75
     * Returns the target ID of this CMIS relationship (CMIS property cmis:targetId).
76
     *
77
     * @return ObjectIdInterface the target ID or <code>null</code> if the property hasn't been requested,
78
     * hasn't been provided by the repository, or the property value isn't set
79
     */
80 View Code Duplication
    public function getTargetId()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
81
    {
82
        $targetId = $this->getPropertyValue(PropertyIds::TARGET_ID);
83
        if (empty($targetId)) {
84
            return null;
85
        }
86
87
        return $this->getSession()->createObjectId($targetId);
88
    }
89
}
90