Passed
Push — master ( 673bfc...65df8d )
by Julito
09:32
created

UserCreatorTrait::getCreator()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Traits;
8
9
use Chamilo\CoreBundle\Entity\ResourceNode;
10
use Chamilo\CoreBundle\Entity\User;
11
12
trait UserCreatorTrait
13
{
14
    public ?ResourceNode $resourceNode = null;
15
    public ?User $resourceNodeCreator = null;
16
17
    public function getCreator(): ?User
18
    {
19
        if (null === $this->resourceNode) {
20
            return null;
21
        }
22
23
        return $this->resourceNode->getCreator();
24
    }
25
26
    public function setCreator(User $user)
27
    {
28
        $this->resourceNodeCreator = $user;
29
30
        return $this;
31
    }
32
33
    public function getResourceNodeCreator(): ?User
34
    {
35
        return $this->resourceNodeCreator;
36
    }
37
}
38