Dimention::getHeight()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Jackal\ImageMerge\ValueObject;
4
5
use InvalidArgumentException;
6
7
class Dimention
8
{
9
    /**
10
     * @var int
11
     */
12
    private $width;
13
14
    /**
15
     * @var int
16
     */
17
    private $height;
18
19
    /**
20
     * Dimention constructor.
21
     * @param $width
22
     * @param $height
23
     */
24
    public function __construct($width, $height)
25
    {
26
        if (!$width) {
27
            $width = null;
28
        }
29
30
        if (!$height) {
31
            $height = null;
32
        }
33
34
        if (is_null($width) and is_null($height)) {
35
            throw new InvalidArgumentException('Both width and height are empty values');
36
        }
37
38
        $this->width = $width;
39
        $this->height = $height;
40
    }
41
42
    /**
43
     * @return int
44
     */
45
    public function getWidth()
46
    {
47
        return $this->width;
48
    }
49
50
    /**
51
     * @return int
52
     */
53
    public function getHeight()
54
    {
55
        return $this->height;
56
    }
57
}
58