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 ( a6964a...ef97fd )
by Denis
02:44
created

SharedStrings   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A buildSharedStringsXML() 0 8 1
A getSst() 0 16 2
1
<?php
2
namespace Ellumilel\Xl;
3
4
/**
5
 * @link https://msdn.microsoft.com/en-us/library/bb264572(v=office.12).aspx
6
 *
7
 * Class Relationships
8
 * @package Ellumilel\Xl
9
 * @author Denis Tikhonov <[email protected]>
10
 */
11
class SharedStrings
12
{
13
    /** @var string */
14
    private $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
15
    /** @var string */
16
    private $urlSchemaFormat = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main';
17
    /** @var int */
18
    private $sharedStringsCount = 0;
19
    /** @var int */
20
    private $sharedStringsLength = 0;
21
    /** @var array */
22
    private $sharedStrings = [];
23
24
    /**
25
     * SharedStrings constructor.
26
     *
27
     * @param int $sharedStringsCount
28
     * @param array $sharedStrings
29
     */
30
    public function __construct($sharedStringsCount = 0, $sharedStrings = [])
31
    {
32
        $this->sharedStringsCount = $sharedStringsCount;
33
        $this->sharedStrings = $sharedStrings;
34
        $this->sharedStringsLength = count($sharedStrings);
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function buildSharedStringsXML()
41
    {
42
        $ssXml = '';
43
        $ssXml .= $this->xml;
44
        $ssXml .= $this->getSst();
45
46
        return $ssXml;
47
    }
48
49
    /**
50
     * @return string
51
     */
52
    private function getSst()
53
    {
54
        $sst = '<sst count="'.
55
            $this->sharedStringsCount.'" uniqueCount="'.
56
            $this->sharedStringsLength.'" xmlns="'.
57
            $this->urlSchemaFormat.'">'
58
        ;
59
60
        foreach ($this->sharedStrings as $s => $item) {
61
            $sst .= '<si><t>'.str_replace("'", "&#39;", htmlspecialchars($s)).'</t></si>';
62
        }
63
64
        $sst .= '</sst>';
65
66
        return $sst;
67
    }
68
}
69