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 ( 44810d...9c6bac )
by Denis
03:46
created

Core::revision()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace Ellumilel\DocProps;
3
4
/**
5
 * @link https://en.wikipedia.org/wiki/Office_Open_XML_file_formats#Document_properties
6
 *
7
 * Class Core
8
 * @package Ellumilel\DocProps
9
 * @author Denis Tikhonov <[email protected]>
10
 */
11
class Core
12
{
13
    /** @var string */
14
    private $author = 'Unknown Author';
15
    /** @var int */
16
    private $revision = 0;
17
    /** @var string */
18
    private $urlCp = 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties';
19
    /** @var string */
20
    private $urlDc = 'http://purl.org/dc/elements/1.1/';
21
    /** @var string */
22
    private $urlDcType = 'http://purl.org/dc/dcmitype/';
23
    /** @var string */
24
    private $urlDcTerms = 'http://purl.org/dc/terms/';
25
    /** @var string */
26
    private $urlSchema = 'http://www.w3.org/2001/XMLSchema-instance';
27
    /** @var string */
28
    private $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
29
30
    /**
31
     * Core constructor.
32
     *
33
     * @param integer $revision
34
     */
35
    public function __construct($revision = 0)
36
    {
37
        $this->revision = $revision;
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function buildCoreXML()
44
    {
45
        $coreXml = '';
46
        $coreXml .= $this->xml;
47
        $coreXml .= $this->getCoreProperties();
48
49
        return $coreXml;
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    private function getCoreProperties()
56
    {
57
        $properties = '<cp:coreProperties xmlns:cp="'.$this->urlCp.'" xmlns:dc="'.
58
            $this->urlDc.'" xmlns:dcmitype="'.$this->urlDcType.'" xmlns:dcterms="'.
59
            $this->urlDcTerms.'" xmlns:xsi="'.$this->urlSchema.'">';
60
        $properties .= $this->created();
61
        $properties .= $this->creator();
62
        $properties .= $this->revision();
63
        $properties .= '</cp:coreProperties>';
64
65
        return $properties;
66
    }
67
68
    /**
69
     * CreatedDate ex: '2016-08-30T15:52:19.00Z';
70
     * @return string
71
     */
72
    private function created()
73
    {
74
        return '<dcterms:created xsi:type="dcterms:W3CDTF">'.date("Y-m-d\TH:i:s.00\Z").'</dcterms:created>';
75
    }
76
77
    /**
78
     * @return string
79
     */
80
    private function creator()
81
    {
82
        return '<dc:creator>'.str_replace("'", "&#39;", htmlspecialchars($this->author)).'</dc:creator>';
83
    }
84
85
    /**
86
     * @return string
87
     */
88
    private function revision()
89
    {
90
        return '<cp:revision>'.$this->revision.'</cp:revision>';
91
    }
92
93
    /**
94
     * @param string $author
95
     *
96
     * @return $this
97
     */
98
    public function setAuthor($author)
99
    {
100
        if (!empty($author)) {
101
            $this->author = $author;
102
        }
103
104
        return $this;
105
    }
106
}
107