Completed
Pull Request — master (#1)
by Rougin
02:47
created

EntityRepository::__call()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 14
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 14
loc 14
ccs 6
cts 8
cp 0.75
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 8
nc 2
nop 2
crap 2.0625
1
<?php
2
3
namespace Rougin\Credo;
4
5
/**
6
 * Entity Repository
7
 *
8
 * @package Credo
9
 * @author  Rougin Royce Gutib <[email protected]>
10
 */
11
class EntityRepository extends \Doctrine\ORM\EntityRepository
12
{
13
    /**
14
     * Calls methods from EntityRepository in underscore case.
15
     *
16
     * @param  string $method
17
     * @param  mixed  $parameters
18
     * @return mixed
19
     */
20 6 View Code Duplication
    public function __call($method, $parameters)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
    {
22 6
        $method = \Doctrine\Common\Util\Inflector::camelize($method);
23
24 6
        if (! method_exists($this, $method)) {
25
            $result = $this;
26
        } else {
27 6
            $class = [ $this, $method ];
28
                
29 6
            $result = call_user_func_array($class, $parameters);
30
        }
31
32 6
        return $result;
33
    }
34
}
35