LockRepository   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 25
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A findLock() 0 6 1
A findByChannel() 0 7 1
1
<?php
2
3
namespace Itkg\DelayEventBundle\Repository;
4
5
use Doctrine\ODM\MongoDB\DocumentRepository;
6
use Itkg\DelayEventBundle\Model\Lock;
7
8
/**
9
 * Class LockRepository
10
 */
11
class LockRepository extends DocumentRepository
12
{
13
    /**
14
     * @return Lock
15
     */
16
    public function findLock()
17
    {
18
        $qb = $this->createQueryBuilder();
19
20
        return $qb->getQuery()->getSingleResult();
21
    }
22
23
    /**
24
     * @param string $channel
25
     *
26
     * @return Lock
27
     */
28
    public function findByChannel($channel)
29
    {
30
        $qb = $this->createQueryBuilder();
31
        $qb->field('channel')->equals($channel);
32
33
        return $qb->getQuery()->getSingleResult();
34
    }
35
}
36