WsBool::getData()   B
last analyzed

Complexity

Conditions 6
Paths 32

Size

Total Lines 26
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 26
rs 8.439
cc 6
eloc 15
nc 32
nop 1
1
<?php
2
namespace Xls\Record;
3
4
use Xls\Worksheet;
5
6
class WsBool extends AbstractRecord
7
{
8
    const NAME = 'WSBOOL';
9
    const ID = 0x0081;
10
11
    /**
12
     * Generate the WSBOOL biff record
13
     * @param Worksheet $sheet
14
     *
15
     * @return string
16
     */
17
    public function getData(Worksheet $sheet)
18
    {
19
        $grbit = 0x0000;
20
21
        // Set the option flags
22
        $grbit |= 0x0001; // Auto page breaks visible
23
        if ($sheet->getOutlineStyle()) {
24
            $grbit |= 0x0020; // Auto outline styles
25
        }
26
        if ($sheet->getOutlineBelow()) {
27
            $grbit |= 0x0040; // Outline summary below
28
        }
29
        if ($sheet->getOutlineRight()) {
30
            $grbit |= 0x0080; // Outline summary right
31
        }
32
        if ($sheet->getPrintSetup()->isFitPage()) {
33
            $grbit |= 0x0100; // Page setup fit to page
34
        }
35
        if ($sheet->isOutlineOn()) {
36
            $grbit |= 0x0400; // Outline symbols displayed
37
        }
38
39
        $data = pack("v", $grbit);
40
41
        return $this->getFullRecord($data);
42
    }
43
}
44