LockRepository::findByChannel()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 6
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 2
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