Completed
Push — master ( 042cc0...8fd558 )
by A.
16:24 queued 11:05
created

EntityId   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 3
A equals() 0 4 1
A getEntityId() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
namespace OpenConext\Value\Saml;
4
5
use OpenConext\Value\Exception\InvalidArgumentException;
6
7
final class EntityId
8
{
9
    /**
10
     * @var string
11
     */
12
    private $entityId;
13
14
    /**
15
     * @param string $entityId
16
     */
17
    public function __construct($entityId)
18
    {
19
        if (!is_string($entityId) || trim($entityId) === '') {
20
            throw InvalidArgumentException::invalidType('non-blank string', 'entityId', $entityId);
21
        }
22
23
        $this->entityId = $entityId;
24
    }
25
26
    /**
27
     * @param EntityId $other
28
     * @return bool
29
     */
30
    public function equals(EntityId $other)
31
    {
32
        return $this->entityId === $other->entityId;
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function getEntityId()
39
    {
40
        return $this->entityId;
41
    }
42
43
    public function __toString()
44
    {
45
        return $this->entityId;
46
    }
47
}
48