UserRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
dl 0
loc 17
ccs 8
cts 8
cp 1
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A save() 0 4 1
A prototype() 0 3 1
A delete() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Uxmp\Core\Orm\Repository;
6
7
use Doctrine\ORM\EntityRepository;
8
use Uxmp\Core\Orm\Model\User;
9
use Uxmp\Core\Orm\Model\UserInterface;
10
11
/**
12
 * @extends EntityRepository<User>
13
 *
14
 * @method null|UserInterface findOneBy(mixed[] $criteria)
15
 * @method null|UserInterface find(mixed $id)
16
 */
17
final class UserRepository extends EntityRepository implements UserRepositoryInterface
18
{
19 1
    public function prototype(): UserInterface
20
    {
21 1
        return new User();
22
    }
23
24 1
    public function save(UserInterface $user): void
25
    {
26 1
        $this->getEntityManager()->persist($user);
27 1
        $this->getEntityManager()->flush();
28
    }
29
30 1
    public function delete(UserInterface $user): void
31
    {
32 1
        $this->getEntityManager()->remove($user);
33 1
        $this->getEntityManager()->flush();
34
    }
35
}
36