MagicMethodsTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 24
ccs 3
cts 6
cp 0.5
rs 10
c 1
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __call() 0 6 2
A __callStatic() 0 3 1
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