Quadrangle::makeWithXY()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 8
rs 10
1
<?php
2
3
namespace Bavix\Geo\Geometry;
4
5
use Bavix\Geo\Coordinate;
6
7
class Quadrangle extends Geometrable
8
{
9
10
    /**
11
     * @var int
12
     */
13
    protected $numberPoints = 4;
14
15
    /**
16
     * @param Coordinate $center
17
     * @param float      $dx
18
     * @param float      $dy
19
     *
20
     * @return static
21
     */
22
    public static function makeWithXY(Coordinate $center, float $dx, float $dy): self
23
    {
24
        $self = new static();
25
        $self->push((clone $center)->plus(-$dx, $dy));
26
        $self->push((clone $center)->plus($dx, $dy));
27
        $self->push((clone $center)->plus($dx, -$dy));
28
        $self->push((clone $center)->plus(-$dx, -$dy));
29
        return $self;
30
    }
31
32
}
33