Selection::getData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
c 4
b 0
f 0
dl 0
loc 22
rs 9.2
cc 1
eloc 17
nc 1
nop 2
1
<?php
2
3
namespace Xls\Record;
4
5
use Xls\Range;
6
7
class Selection extends AbstractRecord
8
{
9
    const NAME = 'SELECTION';
10
    const ID = 0x001D;
11
12
    /**
13
     * Generate the SELECTION record
14
     *
15
     * @param Range $selection
16
     * @param integer $activePane pane position
17
     * @return string
18
     */
19
    public function getData($selection, $activePane)
20
    {
21
        $rwAct = $selection->getRowFrom(); // Active row
22
        $colAct = $selection->getColFrom(); // Active column
23
        $irefAct = 0; // Active cell ref
24
        $cref = 1; // Number of refs
25
26
        $data = pack(
27
            "CvvvvvvCC",
28
            $activePane,
29
            $rwAct,
30
            $colAct,
31
            $irefAct,
32
            $cref,
33
            $selection->getRowFrom(),
34
            $selection->getRowTo(),
35
            $selection->getColFrom(),
36
            $selection->getColTo()
37
        );
38
39
        return $this->getFullRecord($data);
40
    }
41
}
42