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.

ShowUntranslatedCommand::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 2
eloc 14
c 3
b 0
f 0
nc 2
nop 0
dl 0
loc 23
rs 9.7998
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProcyonWeb\TranslationGenerator;
6
7
use Illuminate\Console\Command;
8
9
class ShowUntranslatedCommand extends Command
10
{
11
    protected $signature = 'translation:show-missing {lang=hu}';
12
13
    protected $description = 'Show untranslated strings';
14
15
    public function handle(): void
16
    {
17
        $lang = $this->argument('lang');
18
19
        if (!file_exists('resources/lang/' . $lang . '.json')) {
0 ignored issues
show
Bug introduced by
Are you sure $lang of type null|string|string[] can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

19
        if (!file_exists('resources/lang/' . /** @scrutinizer ignore-type */ $lang . '.json')) {
Loading history...
20
            $this->error($lang . '.json doesn\'t exist');
21
            return;
22
        }
23
24
        $jsonFile = file_get_contents('resources/lang/' . $lang . '.json');
25
26
        $count = collect(json_decode($jsonFile, true))
27
            ->filter(
28
                function ($value, $key) {
29
                    return $key === $value;
30
                }
31
            )->each(
32
                function ($value) {
33
                    $this->line($value);
34
                }
35
            )->count();
36
37
        $this->info('Untranslated lines: ' . $count);
38
    }
39
}