Completed
Push — feature/upgrade-remote-vetting ( 883904 )
by
unknown
65:35
created

ProcessId   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 46
c 0
b 0
f 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 4 1
A notSet() 0 4 1
A __construct() 0 4 1
A getProcessId() 0 4 1
A isValid() 0 7 2
1
<?php
2
/**
3
 * Copyright 2010 SURFnet B.V.
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 *     http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
namespace Surfnet\StepupSelfService\SelfServiceBundle\Service\RemoteVetting\Value;
19
20
class ProcessId
0 ignored issues
show
Coding Style introduced by
Since you have declared the constructor as private, maybe you should also declare the class as final.
Loading history...
21
{
22
    private $processId;
23
24
    /**
25
     * @param $processId
26
     * @return ProcessId
27
     */
28
    public static function create($processId)
29
    {
30
        return new self($processId);
31
    }
32
33
    /**
34
     * @param $processId
35
     * @return ProcessId
36
     */
37
    public static function notSet()
38
    {
39
        return new self('');
40
    }
41
42
    /**
43
     * @param $processId
44
     */
45
    private function __construct($processId)
46
    {
47
        $this->processId = $processId;
48
    }
49
50
    /**
51
     * @return mixed
52
     */
53
    public function getProcessId()
54
    {
55
        return $this->processId;
56
    }
57
58
    public function isValid(ProcessId $id)
59
    {
60
        if (empty($this->processId)) {
61
            return false;
62
        }
63
        return $this->processId == $id->getProcessId();
64
    }
65
}
66