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.

Stub   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 12
c 2
b 0
f 0
dl 0
loc 47
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A fromContent() 0 15 3
A getContent() 0 3 1
A getMappedAlias() 0 3 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
/**
16
 * @internal Experimental implementation of Phar archive internals
17
 */
18
class Stub
19
{
20
    /**
21
     * @param string $content
22
     * @return self
23
     */
24
    public static function fromContent(string $content): self
25
    {
26
        $target = new static();
27
        $target->content = $content;
28
29
        if (
30
            stripos($content, 'Phar::mapPhar(') !== false
31
            && preg_match('#Phar\:\:mapPhar\(([^)]+)\)#', $content, $matches)
32
        ) {
33
            // remove spaces, single & double quotes
34
            // @todo `'my' . 'alias' . '.phar'` is not evaluated here
35
            $target->mappedAlias = trim($matches[1], ' \'"');
36
        }
37
38
        return $target;
39
    }
40
41
    /**
42
     * @var string
43
     */
44
    private $content;
45
46
    /**
47
     * @var string
48
     */
49
    private $mappedAlias = '';
50
51
    /**
52
     * @return string
53
     */
54
    public function getContent()
55
    {
56
        return $this->content;
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function getMappedAlias(): string
63
    {
64
        return $this->mappedAlias;
65
    }
66
}
67