Completed
Push — feature/ra-locations ( cdde00 )
by A.
04:54
created

InstitutionConfigurationId   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A from() 0 4 1
A __construct() 0 4 1
A equals() 0 4 1
1
<?php
2
3
namespace Surfnet\Stepup\Configuration\Value;
4
5
use Rhumsaa\Uuid\Uuid;
6
7
final class InstitutionConfigurationId
8
{
9
    const UUID_NAMESPACE = '09876543-abcd-0987-abcd-098765432109';
10
11
    private $uuid;
12
13
    /**
14
     * @param Institution $institution
15
     * @return InstitutionConfigurationId
16
     */
17
    public static function from(Institution $institution)
18
    {
19
        return new self(Uuid::uuid5(self::UUID_NAMESPACE, $institution->getInstitution()));
20
    }
21
22
    private function __construct($uuid)
23
    {
24
        $this->uuid = $uuid;
25
    }
26
27
    /**
28
     * @param InstitutionConfigurationId $otherInstitutionConfigurationId
29
     * @return bool
30
     */
31
    public function equals(InstitutionConfigurationId $otherInstitutionConfigurationId)
0 ignored issues
show
Comprehensibility Naming introduced by
The variable name $otherInstitutionConfigurationId exceeds the maximum configured length of 30.

Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.

Loading history...
32
    {
33
        return $this->uuid === $otherInstitutionConfigurationId->uuid;
34
    }
35
}
36