AssociationValue   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 92.86%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 6
c 4
b 0
f 0
lcom 1
cbo 0
dl 0
loc 59
ccs 13
cts 14
cp 0.9286
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getPropertyKey() 0 4 1
A getPropertyValue() 0 4 1
A compareTo() 0 12 3
1
<?php
2
3
/*
4
 * To change this license header, choose License Headers in Project Properties.
5
 * To change this template file, choose Tools | Templates
6
 * and open the template in the editor.
7
 */
8
9
namespace Governor\Framework\Saga;
10
11
use JMS\Serializer\Annotation\Type;
12
use Doctrine\Common\Comparable;
13
14
/**
15
 * Description of AssociationValue
16
 *
17
 */
18
class AssociationValue implements Comparable
19
{
20
21
    /**
22
     * @Type ("string")
23
     * @var string
24
     */
25
    private $propertyKey;
26
27
    /**
28
     * @Type ("string")
29
     * @var string
30
     */
31
    private $propertyValue;
32
33
    /**
34
     * 
35
     * @param string $propertyKey
36
     * @param string $propertyValue
37
     */
38 48
    function __construct($propertyKey, $propertyValue)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
39
    {
40 48
        $this->propertyKey = $propertyKey;
41 48
        $this->propertyValue = $propertyValue;
42 48
    }
43
44
    /**
45
     * @return string
46
     */
47 19
    public function getPropertyKey()
48
    {
49 19
        return $this->propertyKey;
50
    }
51
52
    /**
53
     * @return string
54
     */
55 19
    public function getPropertyValue()
56
    {
57 19
        return $this->propertyValue;
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63 6
    public function compareTo($other)
64
    {
65 6
        if (0 !== $keyDiff = strcmp($this->propertyKey, $other->propertyKey)) {
66 3
            return $keyDiff;
67
        }
68
69 6
        if (0 !== $valDiff = strcmp($this->propertyValue, $other->propertyValue)) {
70
            return $valDiff;
71
        }
72
73 6
        return 0;
74
    }
75
76
}
77