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

InstitutionConfigurationId::from()   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 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