Completed
Pull Request — develop (#435)
by Franck
15:48 queued 42s
created

Ellipse   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 35
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A getHashCode() 0 4 1
1
<?php
2
3
/**
4
 * @author Muhammad Hasan Shahid <[email protected]>
5
 * Mindline Analytics Gmbh
6
 */
7
8
namespace PhpOffice\PhpPresentation\Shape;
9
10
use PhpOffice\PhpPresentation\AbstractShape;
11
use PhpOffice\PhpPresentation\ComparableInterface;
12
use PhpOffice\PhpPresentation\Style\Border;
13
14
15
class Ellipse extends AbstractShape implements ComparableInterface
16
{
17
    /**
18
     * Create a new \PhpOffice\PhpPresentation\Shape\Ellipse instance
19
     *
20
     * @param int $fromX
21
     * @param int $fromY
22
     * @param int $toX
23
     * @param int $toY
24
     * @param int $rotation which takes the rotation for ellipse
25
     */
26
    public function __construct($fromX, $fromY, $toX, $toY, $rotation)
27
    {
28
        parent::__construct();
29
        $this->getBorder()->setLineStyle(Border::LINE_SINGLE);
30
31
        $this->setOffsetX($fromX);
32
        $this->setOffsetY($fromY);
33
        $this->setWidth($toX - $fromX);
34
        $this->setHeight($toY - $fromY);
35
        $this->setRotation($rotation);
36
37
    }
38
39
    /**
40
     * Get hash code
41
     *
42
     * @return string Hash code
43
     */
44
    public function getHashCode()
45
    {
46
        return md5($this->getBorder()->getLineStyle() . parent::getHashCode() . __CLASS__);
47
    }
48
49
}
50