Passed
Pull Request — develop_3.0 (#495)
by Adrien
02:52
created

RowManager   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isEmpty() 0 6 3
1
<?php
2
3
namespace Box\Spout\Writer\Common\Manager;
4
5
use Box\Spout\Writer\Common\Entity\Row;
6
use Box\Spout\Writer\Common\Manager\Style\StyleMerger;
7
8
class RowManager
9
{
10
    /**
11
     * @var StyleMerger
12
     */
13
    protected $styleMerger;
14
15
    /**
16
     * @param StyleMerger $styleMerger
17
     */
18 42
    public function __construct(StyleMerger $styleMerger)
19
    {
20 42
        $this->styleMerger = $styleMerger;
21 42
    }
22
23
    /**
24
     * Detect whether a row is considered empty.
25
     * An empty row has either no cells at all - or only one empty cell
26
     *
27
     * @param Row $row
28
     * @return bool
29
     */
30 34
    public function isEmpty(Row $row)
31
    {
32 34
        $cells = $row->getCells();
33
34 34
        return count($cells) === 0 || (count($cells) === 1 && $cells[0]->isEmpty());
35
    }
36
}
37