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

RowManager::applyStyle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
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