Test Failed
Push — master ( 8dd30c...47d367 )
by Hirofumi
49:56
created

Destination   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 29
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
destinationType() 0 1 ?
jsonRepresentation() 0 1 ?
A typedJsonRepresentation() 0 7 1
fromJsonRepresentation() 0 1 ?
1
<?php
2
declare(strict_types=1);
3
4
namespace Shippinno\Notification\Domain\Model;
5
6
use Verraes\ClassFunctions\ClassFunctions;
7
8
abstract class Destination
9
{
10
    /**
11
     * @return string
12
     */
13
    abstract public function destinationType(): string;
14
15
    /**
16
     * @return string
17
     */
18
    abstract public function jsonRepresentation(): string;
19
20
    /**
21
     * @return string
22
     */
23
    public function typedJsonRepresentation(): string
24
    {
25
        $decoded = json_decode($this->jsonRepresentation(), true);
26
        $decoded['type'] = ClassFunctions::short($this);
27
28
        return json_encode($decoded);
29
    }
30
31
    /**
32
     * @param string $stringRepresentation
33
     * @return Destination
34
     */
35
    abstract public static function fromJsonRepresentation(string $stringRepresentation): Destination;
36
}