Completed
Push — master ( 36b213...28832c )
by Pol
15:51
created

StringType   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 28
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __toArray() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace drupol\valuewrapper\Type;
6
7
use drupol\valuewrapper\Contract\Stringable;
8
9
/**
10
 * Class StringType
11
 */
12
class StringType extends TypeValue implements Stringable
13
{
14
    /**
15
     * StringType constructor.
16
     *
17
     * @param string $value
18
     */
19 13
    public function __construct(string $value)
20
    {
21 13
        parent::__construct($value);
22 13
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27 1
    public function __toArray(): array
28
    {
29 1
        return str_split($this->value());
30
    }
31
    
32
    /**
33
     * {@inheritdoc}
34
     */
35 1
    public function __toString(): string
36
    {
37 1
        return (string) $this->value();
38
    }
39
}
40