Guts   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 4
c 4
b 0
f 0
lcom 0
cbo 1
dl 0
loc 45
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getData() 0 29 4
1
<?php
2
3
namespace Xls\Record;
4
5
class Guts extends AbstractRecord
6
{
7
    const NAME = 'GUTS';
8
    const ID = 0x0080;
9
10
    /**
11
     * Generate the GUTS BIFF record. This is used to configure the gutter margins
12
     * where Excel outline symbols are displayed. The visibility of the gutters is
13
     * controlled by a flag in WSBOOL.
14
     *
15
     * @param $colInfo
16
     * @param $outlineRowLevel
17
     *
18
     * @return string
19
     */
20
    public function getData($colInfo, $outlineRowLevel)
21
    {
22
        $dxRwGut = 0x0000; // Size of row gutter
23
        $dxColGut = 0x0000; // Size of col gutter
24
25
        $rowLevel = $outlineRowLevel;
26
        $colLevel = 0;
27
28
        // Calculate the maximum column outline level. The equivalent calculation
29
        // for the row outline level is carried out in setRow().
30
        foreach ($colInfo as $col) {
31
            $colLevel = max($col['level'], $colLevel);
32
        }
33
34
        // Set the limits for the outline levels (0 <= x <= 7).
35
        $colLevel = max(0, min($colLevel, 7));
36
37
        // The displayed level is one greater than the max outline levels
38
        if ($rowLevel) {
39
            $rowLevel++;
40
        }
41
        if ($colLevel) {
42
            $colLevel++;
43
        }
44
45
        $data = pack("vvvv", $dxRwGut, $dxColGut, $rowLevel, $colLevel);
46
47
        return $this->getFullRecord($data);
48
    }
49
}
50