User::getEmail()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Happyr\ApiClient\Model\UserManagement;
4
5
use Happyr\ApiClient\Model\CreatableFromArray;
6
7
/**
8
 * @author Tobias Nyholm <[email protected]>
9
 */
10 View Code Duplication
final class User implements CreatableFromArray
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    /**
13
     * @var string
14
     */
15
    private $name;
16
17
    /**
18
     * @var string
19
     */
20
    private $email;
21
22
    /**
23
     * @param string $name
24
     * @param string $email
25
     */
26
    private function __construct($name, $email)
27
    {
28
        $this->name = $name;
29
        $this->email = $email;
30
    }
31
32
    /**
33
     * @param array $data
34
     *
35
     * @return
36
     */
37
    public static function createFromArray(array $data)
38
    {
39
        $data = $data['data'];
40
41
        return new self(isset($data['name']) ? $data['name']: '', $data['email']);
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getName()
48
    {
49
        return $this->name;
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getEmail()
56
    {
57
        return $this->email;
58
    }
59
}
60