Code Duplication    Length = 50-50 lines in 2 locations

src/Model/Match/ExtendedMatch.php 1 location

@@ 10-59 (lines=50) @@
7
/**
8
 * @author Tobias Nyholm <[email protected]>
9
 */
10
final class ExtendedMatch implements CreatableFromArray
11
{
12
    /**
13
     * @var array
14
     */
15
    private $profiles;
16
17
    /**
18
     * @var bool
19
     */
20
    private $complete;
21
22
    /**
23
     * @param array $profiles
24
     * @param bool  $complete
25
     */
26
    private function __construct(array $profiles, $complete)
27
    {
28
        $this->profiles = $profiles;
29
        $this->complete = $complete;
30
    }
31
32
    /**
33
     * @param array $data
34
     *
35
     * @return
36
     */
37
    public static function createFromArray(array $data)
38
    {
39
        $profiles = isset($data['data']['profiles']) ? $data['data']['profiles'] : [];
40
41
        return new self($profiles, $data['data']['complete']);
42
    }
43
44
    /**
45
     * @return array
46
     */
47
    public function getProfiles()
48
    {
49
        return $this->profiles;
50
    }
51
52
    /**
53
     * @return bool
54
     */
55
    public function isComplete()
56
    {
57
        return $this->complete;
58
    }
59
}
60

src/Model/UserManagement/User.php 1 location

@@ 10-59 (lines=50) @@
7
/**
8
 * @author Tobias Nyholm <[email protected]>
9
 */
10
final class User implements CreatableFromArray
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