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

JString   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 84.62%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 2
dl 0
loc 67
ccs 11
cts 13
cp 0.8462
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A value() 0 4 1
A __toString() 0 4 1
A factory() 0 4 1
A supports() 0 8 3
1
<?php
2
3
namespace Recca0120\Lodash;
4
5
use Recca0120\Lodash\JString\PHP;
6
use Recca0120\Lodash\JString\Javascript;
7
8
class JString
9
{
10
    use Javascript;
11
    use PHP;
12
13
    /**
14
     * $subject.
15
     *
16
     * @var string
17
     */
18
    public $subject;
19
20
    /**
21
     * __construct.
22
     *
23
     * @param string $subject
24
     */
25 30
    public function __construct($subject = '')
26
    {
27 30
        $this->subject = $subject;
28 30
    }
29
30
    /**
31
     * value.
32
     *
33
     * @return string
34
     */
35 20
    public function value()
36
    {
37 20
        return $this->subject;
38
    }
39
40
    /**
41
     * __toString.
42
     *
43
     * @return string
44
     */
45 19
    public function __toString()
46
    {
47 19
        return $this->value();
48
    }
49
50
    /**
51
     * factory.
52
     *
53
     * @param string $subject
54
     * @return static
55
     */
56
    public static function factory($subject = '')
57
    {
58
        return new static((string) $subject);
59
    }
60
61
    /**
62
     * supports.
63
     * @param  static|string $object
64
     * @return bool
65
     */
66 1
    public static function supports($object)
67
    {
68 1
        if ($object instanceof static || is_string($object) === true) {
69 1
            return true;
70
        }
71
72 1
        return false;
73
    }
74
}
75