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.

InstallationId   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
dl 0
loc 24
rs 10
c 2
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 2
1
<?php
2
/**
3
 * InstallationId.php
4
 * Copyright (c) 2020 [email protected]
5
 *
6
 * This file is part of Firefly III (https://github.com/firefly-iii).
7
 *
8
 * This program is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License as
10
 * published by the Free Software Foundation, either version 3 of the
11
 * License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU Affero General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Affero General Public License
19
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
 */
21
22
declare(strict_types=1);
23
24
25
namespace FireflyIII\Http\Middleware;
26
27
use Closure;
28
use FireflyIII\Exceptions\FireflyException;
29
use Log;
30
use Ramsey\Uuid\Uuid;
31
32
/**
33
 *
34
 * Class InstallationId
35
 */
36
class InstallationId
37
{
38
    /**
39
     * Handle an incoming request.
40
     *
41
     * @param \Illuminate\Http\Request $request
42
     * @param Closure                  $next
43
     *
44
     * @throws FireflyException
45
     *
46
     * @return mixed
47
     *
48
     */
49
    public function handle($request, Closure $next)
50
    {
51
        $config = app('fireflyconfig')->get('installation_id', null);
52
        if (null === $config) {
53
            $uuid5    = Uuid::uuid5(Uuid::NAMESPACE_URL, 'firefly-iii.org');
54
            $uniqueId = (string) $uuid5;
55
            Log::info(sprintf('Created Firefly III installation ID %s', $uniqueId));
56
            app('fireflyconfig')->set('installation_id', $uniqueId);
57
        }
58
59
        return $next($request);
60
    }
61
}
62