Passed
Branch master (8fa86f)
by Alexander
04:20
created

Person   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromJson() 0 10 1
1
<?php
2
namespace Horat1us\Examples;
3
4
use Horat1us\XmlConvertible;
5
use Horat1us\XmlConvertibleInterface;
6
7
class Person implements XmlConvertibleInterface
8
{
9
    use XmlConvertible;
10
11
    public $name;
12
13
    public $surname;
14
15
    public static function fromJson(string $json): Person
16
    {
17
        $array = json_decode($json, true);
18
19
        $object = new static;
20
        $object->name = $array['name'] ?? null;
21
        $object->surname = $array['surname'] ?? null;
22
23
        return $object;
24
    }
25
}