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.
Completed
Push — master ( 42c65a...a98f71 )
by
unknown
07:18
created

Relationship::getSourceId()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 9
loc 9
ccs 0
cts 5
cp 0
rs 9.6666
cc 2
eloc 5
nc 2
nop 0
crap 6
1
<?php
2
namespace Dkd\PhpCmis\DataObjects;
3
4
/**
5
 * This file is part of php-cmis-lib.
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)
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)
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()
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()
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