Passed
Push — master ( ca9906...036635 )
by Jeremy
09:50 queued 12s
created

ClientRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 11
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A findOneBy() 0 9 2
1
<?php
2
3
namespace Wallabag\ApiBundle\Repository;
4
5
use Doctrine\ORM\EntityRepository;
6
7
class ClientRepository extends EntityRepository
8
{
9
    public function findOneBy(array $criteria, array $orderBy = null)
10
    {
11
        if (!empty($criteria['id'])) {
12
            // cast client id to be an integer to avoid postgres error:
13
            // "invalid input syntax for integer"
14
            $criteria['id'] = (int) $criteria['id'];
15
        }
16
17
        return parent::findOneBy($criteria, $orderBy);
18
    }
19
}
20