Dimention   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 13
c 2
b 0
f 0
dl 0
loc 49
rs 10
wmc 7

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 5
A getWidth() 0 3 1
A getHeight() 0 3 1
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