SharedStringsTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getData() 0 12 2
1
<?php
2
3
namespace Xls\Record;
4
5
use Xls\SharedStringsTable as SST;
6
7
class SharedStringsTable extends AbstractRecord
8
{
9
    const NAME = 'SST';
10
    const ID = 0x00fc;
11
12
    /**
13
     * Write all of the workbooks strings into an indexed array.
14
     *
15
     * The Excel documentation says that the SST record should be followed by an
16
     * EXTSST record. The EXTSST record is a hash table that is used to optimise
17
     * access to SST. However, despite the documentation it doesn't seem to be
18
     * required so we will ignore it.
19
     *
20
     * @param SST $sst
21
     * @return string
22
     */
23
    public function getData(SST $sst)
24
    {
25
        $data = pack("VV", $sst->getTotalCount(), $sst->getUniqueCount());
26
27
        $length = strlen($data);
28
        $blockSizes = $sst->getBlocksSizes();
29
        if (!empty($blockSizes)) {
30
            $length += array_shift($blockSizes);
31
        }
32
33
        return $this->getHeader($length) . $data;
34
    }
35
}
36