User::loadMetadata()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Models;
6
7
use Doctrine\SkeletonMapper\Hydrator\HydratableInterface;
8
use Doctrine\SkeletonMapper\Mapping\ClassMetadataInterface;
9
use Doctrine\SkeletonMapper\Mapping\LoadMetadataInterface;
10
use Doctrine\SkeletonMapper\ObjectManagerInterface;
11
12
class User implements HydratableInterface, LoadMetadataInterface
13
{
14
    /** @var string */
15
    private $username;
16
17
    public static function loadMetadata(ClassMetadataInterface $metadata) : void
18
    {
19
        $metadata->setIdentifier(['username']);
20
    }
21
22
    /**
23
     * @param mixed[] $project
24
     */
25
    public function hydrate(array $project, ObjectManagerInterface $objectManager) : void
26
    {
27
        $this->username = (string) $project['username'] ?? '';
28
    }
29
30
    public function getUsername() : string
31
    {
32
        return $this->username;
33
    }
34
}
35