DefinedName   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getData() 0 18 1
1
<?php
2
namespace Xls\Record;
3
4
use Xls\StringUtils;
5
6
class DefinedName extends AbstractRecord
7
{
8
    const NAME = 'DEFINEDNAME';
9
    const ID = 0x18;
10
11
    const BUILTIN_PRINT_AREA = 0x06;
12
    const BUILTIN_PRINT_TITLES = 0x07;
13
14
    /**
15
     * @param $type
16
     * @param $sheetIndex
17
     * @param $formulaData
18
     *
19
     * @return string
20
     */
21
    public function getData($type, $sheetIndex, $formulaData)
22
    {
23
        $options = 0x20; // Option flags
24
25
        $name = pack("C", $type);
26
        $nameLen = StringUtils::countCharacters($name);
27
        $name = StringUtils::toBiff8UnicodeLongWoLenInfo($name);
28
29
        $formulaLen = strlen($formulaData);
30
31
        $data = pack("vC", $options, 0);
32
        $data .= pack("Cv", $nameLen, $formulaLen);
33
        $data .= pack("vv", 0, $sheetIndex);
34
        $data .= pack("CCCC", 0, 0, 0, 0);
35
        $data .= $name . $formulaData;
36
37
        return $this->getFullRecord($data);
38
    }
39
}
40