AbstractUser   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 80
ccs 0
cts 31
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A __debugInfo() 0 9 1
A getSystem() 0 4 1
A getId() 0 4 1
A getName() 0 4 1
A getAvatar() 0 4 1
1
<?php
2
/**
3
 * This file is part of Platform package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Karma\Platform\Io;
11
12
/**
13
 * Class AbstractUser
14
 * @package Karma\Platform\Io
15
 */
16
abstract class AbstractUser implements UserInterface
17
{
18
    /**
19
     * @var SystemInterface
20
     */
21
    protected $system;
22
23
    /**
24
     * @var string
25
     */
26
    protected $id;
27
28
    /**
29
     * @var string
30
     */
31
    protected $name;
32
33
    /**
34
     * @var string|null
35
     */
36
    protected $avatar;
37
38
    /**
39
     * User constructor.
40
     * @param SystemInterface $system
41
     * @param string $id
42
     * @param string $name
43
     */
44
    public function __construct(SystemInterface $system, string $id, string $name)
45
    {
46
        $this->system = $system;
47
        $this->id = $id;
48
        $this->name = $name;
49
    }
50
51
    /**
52
     * @return array
53
     */
54
    public function __debugInfo(): array
55
    {
56
        return [
57
            'system' => $this->getSystem()->getName(),
58
            'id'     => $this->getId(),
59
            'name'   => $this->getName(),
60
            'avatar' => $this->getAvatar(),
61
        ];
62
    }
63
64
    /**
65
     * @return SystemInterface
66
     */
67
    public function getSystem(): SystemInterface
68
    {
69
        return $this->system;
70
    }
71
72
    /**
73
     * @return string
74
     */
75
    public function getId(): string
76
    {
77
        return $this->id;
78
    }
79
80
    /**
81
     * @return string
82
     */
83
    public function getName(): string
84
    {
85
        return $this->name;
86
    }
87
88
    /**
89
     * @return null|string
90
     */
91
    public function getAvatar(): ?string
92
    {
93
        return $this->avatar;
94
    }
95
}
96