FavoriteRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A delete() 0 6 1
A prototype() 0 3 1
A save() 0 6 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\Favorite;
9
use Uxmp\Core\Orm\Model\FavoriteInterface;
10
11
/**
12
 * @extends EntityRepository<Favorite>
13
 *
14
 * @method FavoriteInterface[] findBy(mixed[] $criteria, null|array $order = null, null|int $limit = null, null|int $offset = null)
15
 */
16
final class FavoriteRepository extends EntityRepository implements FavoriteRepositoryInterface
17
{
18 1
    public function prototype(): FavoriteInterface
19
    {
20 1
        return new Favorite();
21
    }
22
23 1
    public function save(FavoriteInterface $favorite): void
24
    {
25 1
        $em = $this->getEntityManager();
26
27 1
        $em->persist($favorite);
28 1
        $em->flush();
29
    }
30
31 1
    public function delete(FavoriteInterface $favorite): void
32
    {
33 1
        $em = $this->getEntityManager();
34
35 1
        $em->remove($favorite);
36 1
        $em->flush();
37
    }
38
}
39