ResponseRepository::remove()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 6
ccs 0
cts 4
cp 0
crap 6
rs 10
1
<?php
2
3
namespace App\Repository\Game;
4
5
use App\Entity\Game\Response;
6
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
7
use Doctrine\Persistence\ManagerRegistry;
8
9
/**
10
 * @extends ServiceEntityRepository<Response>
11
 *
12
 * @method Response|null find($id, $lockMode = null, $lockVersion = null)
13
 * @method Response|null findOneBy(array $criteria, array $orderBy = null)
14
 * @method Response[]    findAll()
15
 * @method Response[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
16
 */
17
class ResponseRepository extends ServiceEntityRepository
18
{
19
    public function __construct(ManagerRegistry $registry)
20
    {
21
        parent::__construct($registry, Response::class);
22
    }
23
24
    /** @SuppressWarnings(PHPMD.BooleanArgumentFlag) */
25
    public function save(Response $entity, bool $flush = false): void
26
    {
27
        $this->getEntityManager()->persist($entity);
28
29
        if ($flush) {
30
            $this->getEntityManager()->flush();
31
        }
32
    }
33
34
    /** @SuppressWarnings(PHPMD.BooleanArgumentFlag) */
35
    public function remove(Response $entity, bool $flush = false): void
36
    {
37
        $this->getEntityManager()->remove($entity);
38
39
        if ($flush) {
40
            $this->getEntityManager()->flush();
41
        }
42
    }
43
}
44