Test Failed
Pull Request — master (#10)
by Laurens
03:11 queued 10s
created

Settings   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A new() 0 6 1
A create() 0 7 1
A getEtag() 0 4 1
A getDefaultRefundToLocation() 0 4 1
A getNotificationSettings() 0 4 1
A getPostData() 0 7 1
A __construct() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LauLamanApps\IzettleApi\API\Inventory;
6
7
use LauLamanApps\IzettleApi\API\Inventory\Settings\NotificationSettings;
8
use LauLamanApps\IzettleApi\API\Universal\iZettlePostable;
9
10
final class Settings implements iZettlePostable
0 ignored issues
show
Bug introduced by
There is one abstract method getPostBodyData in this class; you could implement it, or declare this class as abstract.
Loading history...
11
{
12
    private $etag;
13
    private $defaultRefundToLocation;
14
    private $notificationSettings;
15
16
    public function new(
17
        string $defaultRefundToLocation,
18
        NotificationSettings $notificationSettings
19
    ): self {
20
        return new self(null, $defaultRefundToLocation, $notificationSettings);
21
    }
22
23
    public function create(
24
        string $etag,
25
        string $defaultRefundToLocation,
26
        NotificationSettings $notificationSettings
27
    ): self {
28
        return new self($etag, $defaultRefundToLocation, $notificationSettings);
29
    }
30
31
    public function getEtag(): ?string
32
    {
33
        return $this->etag;
34
    }
35
36
    public function getDefaultRefundToLocation(): string
37
    {
38
        return $this->defaultRefundToLocation;
39
    }
40
41
    public function getNotificationSettings(): NotificationSettings
42
    {
43
        return $this->notificationSettings;
44
    }
45
46
    public function getPostData(): array
47
    {
48
        return [
49
                "defaultRefundToLocation" => $this->defaultRefundToLocation,
50
                "notificationSettings" => $this->notificationSettings->getPostData()
51
        ];
52
    }
53
54
    private function __construct(
55
        ?string $etag = null,
56
        string $defaultRefundToLocation,
57
        NotificationSettings $notificationSettings
58
    ) {
59
        $this->etag = $etag;
60
        $this->defaultRefundToLocation = $defaultRefundToLocation;
61
        $this->notificationSettings = $notificationSettings;
62
    }
63
}
64