| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function getBounds(): Bounds |
||
| 19 | { |
||
| 20 | $latMin = 90.0; |
||
| 21 | $latMax = -90.0; |
||
| 22 | $lngMin = 180.0; |
||
| 23 | $lngMax = -180.0; |
||
| 24 | |||
| 25 | /** @var Coordinate $point */ |
||
| 26 | foreach ($this->getPoints() as $point) { |
||
|
|
|||
| 27 | $latMin = min($point->getLat(), $latMin); |
||
| 28 | $lngMin = min($point->getLng(), $lngMin); |
||
| 29 | $latMax = max($point->getLat(), $latMax); |
||
| 30 | $lngMax = max($point->getLng(), $lngMax); |
||
| 31 | } |
||
| 32 | |||
| 33 | return new Bounds( |
||
| 34 | new Coordinate($latMax, $lngMin), |
||
| 35 | new Coordinate($latMin, $lngMax) |
||
| 36 | ); |
||
| 37 | } |
||
| 38 | } |
||
| 39 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.