User   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 5
dl 0
loc 21
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A hydrate() 0 3 1
A loadMetadata() 0 3 1
A getUsername() 0 3 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