Completed
Push — master ( 875476...1855ce )
by Dan
02:56
created

SimpleMask   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 29
ccs 9
cts 9
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 5 1
A overlaps() 0 9 3
1
<?php
2
3
namespace SixtyNine\Cloud;
4
5
use Imagine\Image\PointInterface;
6
use SixtyNine\Cloud\Model\Box;
7
use SixtyNine\Cloud\Model\Word;
8
9
class SimpleMask
10
{
11
    /** @var Box[] */
12
    protected  $boundingBoxes = array();
13
14
    /**
15
     * @param \Imagine\Image\PointInterface $position
16
     * @param Model\Box $box
17
     */
18 4
    public function add(PointInterface $position, Box $box)
19
    {
20 4
        $box = $box->move($position->getX(), $position->getY());
21 4
        $this->boundingBoxes[] = $box;
22 4
    }
23
24
    /**
25
     * @param Box $box
26
     * @return bool
27
     */
28 4
    public function overlaps(Box $box)
29
    {
30 4
        foreach ($this->boundingBoxes as $dBox) {
31 4
            if ($box->intersects($dBox)) {
32 4
                return true;
33
            }
34
        }
35 4
        return false;
36
    }
37
}
38