MagicMethodsTrait   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 92.31%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 28
ccs 12
cts 13
cp 0.9231
rs 10
wmc 9

3 Methods

Rating   Name   Duplication   Size   Complexity  
B __set() 0 16 7
A methodExists() 0 3 1
A exists() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: gareth
5
 * Date: 27-8-15
6
 * Time: 10:27
7
 */
8
9
namespace garethp\ews\API;
10
11
use garethp\ews\Caster;
0 ignored issues
show
Bug introduced by
The type garethp\ews\Caster was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
13
trait MagicMethodsTrait
14
{
15 31
    public function __set($name, $value)
16
    {
17 31
        if (is_object($value) && !($value instanceof Type) && property_exists($value, "Entry")) {
18 4
            $value = $value->Entry;
19
        }
20
21 31
        if ($this->methodExists("set" . ucfirst($name))) {
22 31
            $this->{"set" . ucfirst($name)}($value);
23 31
            return;
24
        }
25
26 5
        if (!$this->exists($name) && $this->exists(lcfirst($name))) {
27
            $name = lcfirst($name);
28
        }
29
30 5
        $this->$name = $value;
31
    }
32
33 30
    public function exists($name)
34
    {
35 30
        return property_exists($this, $name);
36
    }
37
38 31
    public function methodExists($name)
39
    {
40 31
        return method_exists($this, $name);
41
    }
42
}
43