List_   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createFromResponse() 0 8 1
A updateFromResponse() 0 15 1
1
<?php
2
3
namespace Mrkj\Laposta\Models;
4
5
class List_
6
{
7
    public $accountId;
8
    public $id;
9
    public $created;
10
    public $modified;
11
    public $state;
12
    public $name;
13
    public $remarks;
14
    public $subscribeNotificationEmail;
15
    public $unsubsribeNotificationEmail;
16
    public $numberOfActiveMembers;
17
    public $numberOfUnsubscribedMembers;
18
    public $numberOfCleanedMembers;
19
20
    /**
21
     * @param array $response
22
     * @return List_
23
     */
24
    public static function createFromResponse(array $response): self
25
    {
26
        $self = new self;
27
28
        $self->updateFromResponse($response);
29
30
        return $self;
31
    }
32
33
    /**
34
     * @param array $response
35
     */
36
    public function updateFromResponse(array $response)
37
    {
38
        $this->accountId = $response['account_id'];
39
        $this->id = $response['list_id'];
40
        $this->created = $response['created'];
41
        $this->modified = $response['modified'];
42
        $this->state = $response['state'];
43
        $this->name = $response['name'];
44
        $this->remarks = $response['remarks'];
45
        $this->subscribeNotificationEmail = $response['subscribe_notification_email'];
46
        $this->unsubsribeNotificationEmail = $response['unsubscribe_notification_email'];
47
        $this->numberOfActiveMembers = $response['members']['active'];
48
        $this->numberOfUnsubscribedMembers = $response['members']['unsubscribed'];
49
        $this->numberOfCleanedMembers = $response['members']['cleaned'];
50
    }
51
}
52