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.

Manifest   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 159
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 40
c 1
b 0
f 0
dl 0
loc 159
rs 10
wmc 13

11 Methods

Rating   Name   Duplication   Size   Complexity  
A getAmountOfFiles() 0 3 1
A deserializeMetaData() 0 17 3
A getMetaDataLength() 0 3 1
A getApiVersion() 0 3 1
A getMetaData() 0 3 1
A getManifestLength() 0 3 1
A getFlags() 0 3 1
A fromContent() 0 19 1
A getAliasLength() 0 3 1
A getAlias() 0 3 1
A __construct() 0 2 1
1
<?php
2
declare(strict_types=1);
3
namespace TYPO3\PharStreamWrapper\Phar;
4
5
/*
6
 * This file is part of the TYPO3 project.
7
 *
8
 * It is free software; you can redistribute it and/or modify it under the terms
9
 * of the MIT License (MIT). For the full copyright and license information,
10
 * please read the LICENSE file that was distributed with this source code.
11
 *
12
 * The TYPO3 project - inspiring people to share!
13
 */
14
15
class Manifest
16
{
17
    /**
18
     * @param string $content
19
     * @return self
20
     * @see http://php.net/manual/en/phar.fileformat.phar.php
21
     */
22
    public static function fromContent(string $content): self
23
    {
24
        $target = new static();
25
        $target->manifestLength = Reader::resolveFourByteLittleEndian($content, 0);
26
        $target->amountOfFiles = Reader::resolveFourByteLittleEndian($content, 4);
27
        $target->flags = Reader::resolveFourByteLittleEndian($content, 10);
28
        $target->aliasLength = Reader::resolveFourByteLittleEndian($content, 14);
29
        $target->alias = substr($content, 18, $target->aliasLength);
30
        $target->metaDataLength = Reader::resolveFourByteLittleEndian($content, 18 + $target->aliasLength);
31
        $target->metaData = substr($content, 22 + $target->aliasLength, $target->metaDataLength);
32
33
        $apiVersionNibbles = Reader::resolveTwoByteBigEndian($content, 8);
34
        $target->apiVersion = implode('.', [
35
            ($apiVersionNibbles & 0xf000) >> 12,
36
            ($apiVersionNibbles & 0x0f00) >> 8,
37
            ($apiVersionNibbles & 0x00f0) >> 4,
38
        ]);
39
40
        return $target;
41
    }
42
43
    /**
44
     * @var int
45
     */
46
    private $manifestLength;
47
48
    /**
49
     * @var int
50
     */
51
    private $amountOfFiles;
52
53
    /**
54
     * @var string
55
     */
56
    private $apiVersion;
57
58
    /**
59
     * @var int
60
     */
61
    private $flags;
62
63
    /**
64
     * @var int
65
     */
66
    private $aliasLength;
67
68
    /**
69
     * @var string
70
     */
71
    private $alias;
72
73
    /**
74
     * @var int
75
     */
76
    private $metaDataLength;
77
78
    /**
79
     * @var string
80
     */
81
    private $metaData;
82
83
    /**
84
     * Avoid direct instantiation.
85
     */
86
    private function __construct()
87
    {
88
    }
89
90
    /**
91
     * @return int
92
     */
93
    public function getManifestLength(): int
94
    {
95
        return $this->manifestLength;
96
    }
97
98
    /**
99
     * @return int
100
     */
101
    public function getAmountOfFiles(): int
102
    {
103
        return $this->amountOfFiles;
104
    }
105
106
    /**
107
     * @return string
108
     */
109
    public function getApiVersion(): string
110
    {
111
        return $this->apiVersion;
112
    }
113
114
    /**
115
     * @return int
116
     */
117
    public function getFlags(): int
118
    {
119
        return $this->flags;
120
    }
121
122
    /**
123
     * @return int
124
     */
125
    public function getAliasLength(): int
126
    {
127
        return $this->aliasLength;
128
    }
129
130
    /**
131
     * @return string
132
     */
133
    public function getAlias(): string
134
    {
135
        return $this->alias;
136
    }
137
138
    /**
139
     * @return int
140
     */
141
    public function getMetaDataLength(): int
142
    {
143
        return $this->metaDataLength;
144
    }
145
146
    /**
147
     * @return string
148
     */
149
    public function getMetaData(): string
150
    {
151
        return $this->metaData;
152
    }
153
154
    /**
155
     * @return mixed|null
156
     */
157
    public function deserializeMetaData()
158
    {
159
        if (empty($this->metaData)) {
160
            return null;
161
        }
162
163
        $result = unserialize($this->metaData, ['allowed_classes' => false]);
164
165
        $serialized = json_encode($result);
166
        if (strpos($serialized, '__PHP_Incomplete_Class_Name') !== false) {
167
            throw new DeserializationException(
168
                'Meta-data contains serialized object',
169
                1539623382
170
            );
171
        }
172
173
        return $result;
174
    }
175
}
176