Completed
Push — master ( 1ea133...692929 )
by recca
07:00
created

JArray   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 38
ccs 4
cts 8
cp 0.5
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A value() 0 4 1
A factory() 0 4 1
A supports() 0 8 3
1
<?php
2
3
namespace Recca0120\Lodash;
4
5
use ArrayObject;
6
use Recca0120\Lodash\JArray\Javascript;
7
8
class JArray extends ArrayObject
9
{
10
    use Javascript;
11
12
    /**
13
     * value.
14
     *
15
     * @return array
16
     */
17
    public function value()
18
    {
19
        return $this->subject;
1 ignored issue
show
Bug introduced by
The property subject does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
20
    }
21
22
    /**
23
     * factory.
24
     * @param array $subject
25
     * @return static
26
     */
27
    public static function factory($subject = [])
28
    {
29
        return new static((array) $subject);
30
    }
31
32
    /**
33
     * supports.
34
     * @param  static|array $object
35
     * @return bool
36
     */
37 1
    public static function supports($object)
38
    {
39 1
        if ($object instanceof static || is_array($object) === true) {
40 1
            return true;
41
        }
42
43 1
        return false;
44
    }
45
}
46