Location::getAddress()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Extension "sf_event_mgt" for TYPO3 CMS.
7
 *
8
 * For the full copyright and license information, please read the
9
 * LICENSE.txt file that was distributed with this source code.
10
 */
11
12
namespace DERHANSEN\SfEventMgt\Domain\Model;
13
14
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
0 ignored issues
show
Bug introduced by
The type TYPO3\CMS\Extbase\DomainObject\AbstractEntity was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
16
class Location extends AbstractEntity
17
{
18
    protected string $title = '';
19
    protected string $address = '';
20
    protected string $zip = '';
21
    protected string $city = '';
22
    protected string $country = '';
23
    protected string $description = '';
24
    protected string $link = '';
25
    protected float $longitude = 0.0;
26
    protected float $latitude = 0.0;
27
28
    public function getTitle(): string
29
    {
30
        return $this->title;
31
    }
32
33
    public function setTitle(string $title): void
34
    {
35
        $this->title = $title;
36
    }
37
38
    public function getAddress(): string
39
    {
40
        return $this->address;
41
    }
42
43
    public function setAddress(string $address): void
44
    {
45
        $this->address = $address;
46
    }
47
48
    public function getZip(): string
49
    {
50
        return $this->zip;
51
    }
52
53
    public function setZip(string $zip): void
54
    {
55
        $this->zip = $zip;
56
    }
57
58
    public function getCity(): string
59
    {
60
        return $this->city;
61
    }
62
63
    public function setCity(string $city): void
64
    {
65
        $this->city = $city;
66
    }
67
68
    public function getCountry(): string
69
    {
70
        return $this->country;
71
    }
72
73
    public function setCountry(string $country): void
74
    {
75
        $this->country = $country;
76
    }
77
78
    public function getDescription(): string
79
    {
80
        return $this->description;
81
    }
82
83
    public function setDescription(string $description): void
84
    {
85
        $this->description = $description;
86
    }
87
88
    public function getLink(): string
89
    {
90
        return $this->link;
91
    }
92
93
    public function setLink(string $link): void
94
    {
95
        $this->link = $link;
96
    }
97
98
    public function getLongitude(): float
99
    {
100
        return $this->longitude;
101
    }
102
103
    public function setLongitude(float $longitude): void
104
    {
105
        $this->longitude = $longitude;
106
    }
107
108
    public function getLatitude(): float
109
    {
110
        return $this->latitude;
111
    }
112
113
    public function setLatitude(float $latitude): void
114
    {
115
        $this->latitude = $latitude;
116
    }
117
118
    /**
119
     * Special getter to return the full address of the location
120
     *
121
     * @param string $separator
122
     * @return string
123
     */
124
    public function getFullAddress(string $separator = '<br/>'): string
125
    {
126
        $locationData = [];
127
        $locationData[] = $this->getTitle();
128
        $locationData[] = $this->getAddress();
129
        $locationData[] = trim($this->getZip() . ' ' . $this->getCity());
130
        $locationData[] = $this->getCountry();
131
        $locationData = array_filter(
132
            $locationData,
133
            function ($value) {
134
                return str_replace(' ', '', $value) !== '';
135
            }
136
        );
137
        return implode($separator, $locationData);
138
    }
139
}
140