Passed
Pull Request — main (#28)
by
unknown
12:00 queued 02:55
created

Location::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 6
rs 10
1
<?php
2
3
namespace NotificationChannels\WhatsApp\Component;
4
5
class Location extends Component
6
{
7
    protected string $name;
8
    protected string $address;
9
    protected float $latitude;
10
    protected float $longitude;
11
12
    public function __construct(string $name, string $address, float $latitude, float $longitude)
13
    {
14
        $this->name = $name;
15
        $this->address = $address;
16
        $this->latitude = $latitude;
17
        $this->longitude = $longitude;
18
    }
19
20
    public function toArray(): array
21
    {
22
        return [
23
            'type' => 'location',
24
            'location' => [
25
                'latitude' => (string) $this->latitude,
26
                'longitude' => (string) $this->longitude,
27
                'name' => $this->name,
28
                'address' => $this->address,
29
            ],
30
        ];
31
    }
32
}
33