Issues (995)

app/Console/Commands/NntmuxPopulateSteamApps.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace App\Console\Commands;
4
5
use App\Services\SteamService;
0 ignored issues
show
The type App\Services\SteamService was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Illuminate\Console\Command;
7
8
class NntmuxPopulateSteamApps extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'nntmux:populate-steam-apps';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Populate Steam apps table';
23
24
    /**
25
     * Execute the console command.
26
     */
27
    public function handle(): void
28
    {
29
        try {
30
            $this->info('Populating steam apps table...');
31
32
            $service = new SteamService;
33
            $stats = $service->populateSteamAppsTable(function ($processed, $total) {
34
                if ($processed % 1000 === 0) {
35
                    $this->info("Processed {$processed} of {$total} apps");
36
                }
37
            });
38
39
            $this->info(sprintf(
40
                'Added %d new steam app(s), %d skipped, %d errors',
41
                $stats['inserted'],
42
                $stats['skipped'],
43
                $stats['errors']
44
            ));
45
        } catch (\Exception $e) {
46
            $this->error($e->getMessage());
47
            $this->error('There was an error populating the steam_apps table');
48
        }
49
    }
50
}
51