MagicMethodsTrait::__call()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 2
nop 2
dl 0
loc 6
ccs 3
cts 4
cp 0.75
crap 2.0625
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Nip\Inflector\Traits;
4
5
use Nip\Inflector\Inflector;
6
7
/**
8
 * Trait MagicMethodsTrait
9
 * @package Nip\Inflector\Traits
10
 */
11
trait MagicMethodsTrait
12
{
13
14
    /**
15
     * @param $name
16
     * @param $arguments
17
     * @return string
18
     */
19 21
    public function __call($name, $arguments)
20
    {
21 21
        if ($this->hasInflection($name)) {
0 ignored issues
show
Bug introduced by
The method hasInflection() does not exist on Nip\Inflector\Traits\MagicMethodsTrait. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
        if ($this->/** @scrutinizer ignore-call */ hasInflection($name)) {
Loading history...
22 21
            return $this->doInflection($name, $arguments[0]);
0 ignored issues
show
Bug introduced by
The method doInflection() does not exist on Nip\Inflector\Traits\MagicMethodsTrait. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
            return $this->/** @scrutinizer ignore-call */ doInflection($name, $arguments[0]);
Loading history...
23
        }
24
        throw new \BadFunctionCallException("invalid inflection {$name}");
25
    }
26
27
    /**
28
     * @param $name
29
     * @param $arguments
30
     * @return mixed
31
     */
32
    public static function __callStatic($name, $arguments)
33
    {
34
        return (new Inflector())->doInflection($name, $arguments[0]);
35
    }
36
}
37