Completed
Push — master ( 8c968a...c71f44 )
by Rougin
04:50
created

EntityRepository::__call()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 5
cts 6
cp 0.8333
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 2
crap 2.0185
1
<?php
2
3
namespace Rougin\Credo;
4
5
use Doctrine\Common\Util\Inflector;
6
use Doctrine\ORM\EntityRepository as BaseEntityRepository;
7
8
/**
9
 * Entity Repository
10
 *
11
 * @package Credo
12
 * @author  Rougin Royce Gutib <[email protected]>
13
 */
14
class EntityRepository extends BaseEntityRepository
15
{
16
    /**
17
     * Calls methods from EntityRepository in underscore case.
18
     *
19
     * @param  string $method
20
     * @param  mixed  $parameters
21
     * @return mixed
22
     */
23 6
    public function __call($method, $parameters)
24
    {
25 6
        $method = Inflector::camelize($method);
26
27 6
        if (method_exists($this, $method)) {
28 6
            $class = [$this, $method];
29
            
30 6
            return call_user_func_array($class, $parameters);
31
        }
32
33
        return $this;
34
    }
35
}
36