Passed
Push — dependabot/npm_and_yarn/nanoid... ( aaf2c9...c4aa90 )
by
unknown
14:37 queued 06:22
created

ValidationTokenRepository   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 22
rs 10
c 1
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A remove() 0 6 2
A save() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Repository;
8
9
use Chamilo\CoreBundle\Entity\ValidationToken;
10
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
11
use Doctrine\Persistence\ManagerRegistry;
12
13
class ValidationTokenRepository extends ServiceEntityRepository
14
{
15
    public function __construct(ManagerRegistry $registry)
16
    {
17
        parent::__construct($registry, ValidationToken::class);
18
    }
19
20
    public function save(ValidationToken $entity, bool $flush = false): void
21
    {
22
        $this->getEntityManager()->persist($entity);
23
24
        if ($flush) {
25
            $this->getEntityManager()->flush();
26
        }
27
    }
28
29
    public function remove(ValidationToken $entity, bool $flush = false): void
30
    {
31
        $this->getEntityManager()->remove($entity);
32
33
        if ($flush) {
34
            $this->getEntityManager()->flush();
35
        }
36
    }
37
}
38