Completed
Push — master ( d791dd...2d8ee5 )
by Ventaquil
02:14
created

Line4D::checkPoint()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
1
<?php
2
3
namespace PHPAlgorithms\GraphTools;
4
5
use PHPAlgorithms\GraphTools\Interfaces\LineInterface;
6
use PHPAlgorithms\GraphTools\Exceptions\LineException;
7
8
class Line4D extends Line3D implements LineInterface {
9
    protected function checkPoint($point)
10
    {
11
        if (!($point instanceof Point4D)) {
12
            throw new LineException('This is not a point');
13
        }
14
    }
15
16
    protected function countWidth()
17
    {
18
        return sqrt(pow($this->from->x - $this->to->x, 2) + pow($this->from->y - $this->to->y, 2) + pow($this->from->z - $this->to->z, 2) + pow($this->from->t - $this->to->t, 2));
19
    }
20
21
    public function __construct($from, $to)
22
    {
23
        parent::__construct($from, $to);
24
    }
25
}
26