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 ( c6607f...d7595a )
by Bruno
02:40
created

VisitedAssociationLogger::visitAssociation()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Onurb\Doctrine\ORMMetadataGrapher\YumlMetadataGrapher\StringGenerator;
4
5
class VisitedAssociationLogger implements VisitedAssociationLoggerInterface
6
{
7
    /**
8
     * Temporary array where already visited collections are stored
9
     *
10
     * @var array
11
     */
12
    protected $visitedAssociations = array();
13
14
    /**
15
     * @return array
16
     */
17 2
    public function getVisitedAssociations()
18
    {
19 2
        return $this->visitedAssociations;
20
    }
21
22
    /**
23
     * Visit a given association and mark it as visited
24
     *
25
     * @param string      $className
26
     * @param string|null $association
27
     *
28
     * @return bool true if the association was visited before
29
     */
30 5
    public function visitAssociation($className, $association = null)
31
    {
32 5
        if (null === $association) {
33 5
            return $this->visitSingleSidedAssociation($className);
34
        }
35
36 4
        return $this->visitDoubleSidedAssociation($className, $association);
37
    }
38
39
    /**
40
     * @param string $className
41
     * @param string|null $association
42
     * @return bool
43
     */
44 5
    protected function isVisitedAssociation($className, $association = null)
45
    {
46 5
        return null === $association ?
47 5
            isset($this->visitedAssociations[$className]) :
48 5
            isset($this->visitedAssociations[$className][$association]);
49
    }
50
51
    /**
52
     * @param string $className
53
     * @return bool
54
     */
55 5
    protected function visitSingleSidedAssociation($className)
56
    {
57 5
        if ($this->isVisitedAssociation($className)) {
58 4
            return false;
59
        }
60
61 5
        $this->visitedAssociations[$className] = array();
62
63 5
        return true;
64
    }
65
66
    /**
67
     * @param string $className
68
     * @param string $association
69
     * @return bool
70
     */
71 4
    protected function visitDoubleSidedAssociation($className, $association)
72
    {
73 4
        $this->visitSingleSidedAssociation($className);
74
75 4
        if ($this->isVisitedAssociation($className, $association)) {
76 1
            return false;
77
        }
78
79 4
        $this->visitedAssociations[$className][$association] = true;
80
81 4
        return true;
82
    }
83
}
84