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

Association::getLast()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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