Bind   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 32
ccs 8
cts 8
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setProperty() 0 7 1
A getProperty() 0 7 1
1
<?php
2
3
namespace Bavix\Tests;
4
5
abstract class Bind
6
{
7
8
    /**
9
     * @param object $object
10
     * @param string $attr
11
     *
12
     * @return mixed
13
     */
14
    public static function getProperty($object, $attr)
15
    {
16 1
        $closure = \Closure::bind(function () use ($attr) {
17 1
            return $this->$attr;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
18 1
        }, $object, \get_class($object));
19
20 1
        return $closure();
21
    }
22
23
    /**
24
     * @param object $object
25
     * @param string $attr
26
     * @param mixed  $value
27
     *
28
     * @return mixed
29
     */
30
    public static function setProperty($object, $attr, $value)
31
    {
32 1
        $closure = \Closure::bind(function ($value) use ($attr) {
33 1
            $this->$attr = $value;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
34 1
        }, $object, \get_class($object));
35
36 1
        return $closure($value);
37
    }
38
39
}
40