Test Failed
Pull Request — master (#115)
by Alex
03:31
created

Association   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 10
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 64
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getFirst() 0 4 1
A setFirst() 0 4 1
A getLast() 0 4 1
A setLast() 0 4 1
B isOk() 0 19 6
1
<?php
2
3
namespace AlgoWeb\PODataLaravel\Models;
4
5
class Association
6
{
7
    /**
8
     * @var AssociationStubBase
9
     */
10
    protected $first;
11
12
    /**
13
     * @var AssociationStubBase
14
     */
15
    protected $last;
16
17
    /**
18
     * @return AssociationStubBase
19
     */
20
    public function getFirst()
21
    {
22
        return $this->first;
23
    }
24
25
    /**
26
     * @param AssociationStubBase $first
27
     */
28
    public function setFirst(AssociationStubBase $first)
29
    {
30
        $this->first = $first;
31
    }
32
33
    /**
34
     * @return AssociationStubBase
35
     */
36
    public function getLast()
37
    {
38
        return $this->last;
39
    }
40
41
    /**
42
     * @param AssociationStubBase $last
43
     */
44
    public function setLast(AssociationStubBase $last)
45
    {
46
        $this->last = $last;
47
    }
48
49
    public function isOk()
50
    {
51
        $first = $this->getFirst();
52
        $last = $this->getLast();
53
        if (null === $first || !$first->isOk()) {
54
            return false;
55
        }
56
        if (null === $last || !$last->isOk()) {
57
            return false;
58
        }
59
        if (!$first->isCompatible($last)) {
60
            return false;
61
        }
62
        return -1 === $first->compare($last);
63
        //if (-1 !== $first->compare($last)) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
64
        //    return false;
65
       // }
66
        //return true;
67
    }
68
}
69