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.

ProjectVersionSlot   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getProjectVersion() 0 16 2
1
<?php
2
declare(strict_types=1);
3
4
namespace KamiYang\ProjectVersion\Backend\ToolbarItems;
5
6
/*
7
 * This file is part of the ProjectVersion project.
8
 *
9
 * It is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU General Public License as published by
11
 * the Free Software Foundation, either version 3 of the License, or
12
 * (at your option) any later version.
13
 *
14
 * For the full copyright and license information, please read
15
 * LICENSE file that was distributed with this source code.
16
 */
17
18
use KamiYang\ProjectVersion\Facade\LocalizationUtilityFacade;
19
use KamiYang\ProjectVersion\Service\ProjectVersionService;
20
use TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem;
21
use TYPO3\CMS\Core\SingletonInterface;
22
use TYPO3\CMS\Core\Utility\GeneralUtility;
23
use TYPO3\CMS\Core\Utility\StringUtility;
24
use TYPO3\CMS\Extbase\Object\ObjectManager;
25
26
/**
27
 * Class ProjectVersionSlot
28
 */
29
final class ProjectVersionSlot implements SingletonInterface
30
{
31
    /**
32
     * @param \TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem $pObj
33
     */
34
    public function getProjectVersion(SystemInformationToolbarItem $pObj)
35
    {
36
        $projectVersion = GeneralUtility::makeInstance(ObjectManager::class)
37
            ->get(ProjectVersionService::class)
38
            ->getProjectVersion();
39
40
        $version = $projectVersion->getVersion();
41
42
        if (StringUtility::beginsWith($version, 'LLL:')) {
43
            $version = GeneralUtility::makeInstance(LocalizationUtilityFacade::class)->translate($version);
44
        }
45
46
        $pObj->addSystemInformation(
47
            $projectVersion->getTitle(),
48
            $version,
49
            $projectVersion->getIconIdentifier()
50
        );
51
    }
52
}
53