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.

VersionInfoService::getInstalledPackages()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 10
nc 2
nop 0
dl 0
loc 17
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/*
3
 * laravel-money-manager-ex
4
 *
5
 * This File belongs to to Project laravel-money-manager-ex
6
 *
7
 * @author Oliver Kaufmann <[email protected]>
8
 * @version 1.0
9
 */
10
11
namespace App\Services;
12
13
use Cache;
14
use Log;
15
use Symfony\Component\Process\Process;
16
17
class VersionInfoService
18
{
19
    /**
20
     * @return mixed|string
21
     */
22
    public function packageInfo()
23
    {
24
        return Cache::get('mmex-version-info', function () {
25
            return $this->getInstalledPackages();
26
        });
27
    }
28
29
    /**
30
     * @return mixed
31
     */
32
    protected function getInstalledPackages()
33
    {
34
        $process = new Process('composer show -i -f json', base_path());
35
        $process->run();
36
        $output = $process->getOutput();
37
38
        if (!$process->isSuccessful()) {
39
            Log::error($process->getErrorOutput());
40
41
            return [];
42
        }
43
44
        $output = json_decode($output, true);
45
        $r = $output['installed'];
46
47
        return $r;
48
    }
49
}
50