GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 610aa0...6cebac )
by Denis
02:47
created

Workbook::buildWorkbookXML()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 23
rs 9.0856
cc 2
eloc 18
nc 2
nop 0
1
<?php
2
namespace Ellumilel\Xl;
3
4
use Ellumilel\Sheet;
5
6
/**
7
 * @link https://msdn.microsoft.com/en-us/library/bb264572(v=office.12).aspx
8
 *
9
 * Class Workbook
10
 * @package Ellumilel\Xl
11
 * @author Denis Tikhonov <[email protected]>
12
 */
13
class Workbook
14
{
15
    /** @var string */
16
    private $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
17
    /** @var string */
18
    private $urlSchemaFormat = 'http://schemas.openxmlformats.org/officeDocument/2006';
19
    /** @var string */
20
    private $urlOpenXmlFormat = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main';
21
    /** @var array */
22
    private $sheets = [];
23
24
    /**
25
     * @return string
26
     */
27
    public function buildWorkbookXML()
28
    {
29
        $i = 0;
30
        $xml = '';
31
        $xml .= $this->xml;
32
        $xml .= '<workbook xmlns="'.$this->urlOpenXmlFormat.'" xmlns:r="'.$this->urlSchemaFormat.'/relationships">';
33
        $xml .= '<fileVersion appName="Calc"/><workbookPr backupFile="false"';
34
        $xml .= ' showObjects="all" date1904="false"/><workbookProtection/>';
35
        $xml .= '<bookViews><workbookView activeTab="0" firstSheet="0" showHorizontalScroll="true"';
36
        $xml .= ' showSheetTabs="true" showVerticalScroll="true" tabRatio="212" windowHeight="8192"';
37
        $xml .= ' windowWidth="16384" xWindow="0" yWindow="0"/></bookViews>';
38
        $xml .= '<sheets>';
39
        /** @var Sheet $sheet */
40
        foreach ($this->sheets as $sheet_name => $sheet) {
41
            $xml .= '<sheet name="'.str_replace("'", "&#39;", htmlspecialchars($sheet->getSheetName())).'"';
42
            $xml .= ' sheetId="'.($i + 1).'" state="visible" r:id="rId'.($i + 2).'"/>';
43
            $i++;
44
        }
45
        $xml .= '</sheets>';
46
        $xml .= '<calcPr iterateCount="100" refMode="A1" iterate="false" iterateDelta="0.001"/></workbook>';
47
48
        return $xml;
49
    }
50
51
    /**
52
     * @param array $sheets
53
     *
54
     * @return $this
55
     */
56
    public function setSheet(array $sheets)
57
    {
58
        $this->sheets = $sheets;
59
60
        return $this;
61
    }
62
}
63