Code Duplication    Length = 12-14 lines in 2 locations

src/Entities/InputLocationMessageContent.php 1 location

@@ 33-44 (lines=12) @@
30
     * @param array $data
31
     * @throws \Longman\TelegramBot\Exception\TelegramException
32
     */
33
    public function __construct(array $data)
34
    {
35
        $this->latitude = isset($data['latitude']) ? $data['latitude'] : null;
36
        if (empty($this->latitude)) {
37
            throw new TelegramException('latitude is empty!');
38
        }
39
40
        $this->longitude = isset($data['longitude']) ? $data['longitude'] : null;
41
        if (empty($this->longitude)) {
42
            throw new TelegramException('longitude is empty!');
43
        }
44
    }
45
}
46

src/Entities/Location.php 1 location

@@ 33-46 (lines=14) @@
30
     * @param array $data
31
     * @throws \Longman\TelegramBot\Exception\TelegramException
32
     */
33
    public function __construct(array $data)
34
    {
35
        $this->longitude = isset($data['longitude']) ? $data['longitude'] : null;
36
        if (empty($this->longitude)) {
37
            throw new TelegramException('longitude is empty!');
38
        }
39
40
        $this->latitude = isset($data['latitude']) ? $data['latitude'] : null;
41
        if (empty($this->latitude)) {
42
            throw new TelegramException('latitude is empty!');
43
        }
44
    }
45
46
    /**
47
     * Get longitude
48
     *
49
     * @return mixed|null