Quadrangle   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 23
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A makeWithXY() 0 8 1
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