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

Location   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 16
c 2
b 0
f 0
dl 0
loc 24
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A toArray() 0 9 1
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