Completed
Pull Request — develop (#435)
by Franck
09:07
created

Ellipse::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 5
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