Passed
Push — develop ( fa8250...5e004b )
by Nikita
12:49
created

UpgradeGames   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 11
c 1
b 0
f 1
dl 0
loc 47
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 2
A __construct() 0 5 1
1
<?php
2
3
namespace Gameap\Console\Commands;
4
5
use Gameap\Repositories\GameRepository;
6
use Illuminate\Console\Command;
7
8
class UpgradeGames extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'games:upgrade';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Upgrade games';
23
24
    /**
25
     * The GameRepository instance.
26
     *
27
     * @var \Gameap\Repositories\GameRepository
28
     */
29
    protected $repository;
30
31
32
    /**
33
     * Create a new command instance.
34
     *
35
     * @param  \Gameap\Repositories\GameRepository $repository
36
     */
37
    public function __construct(GameRepository $repository)
38
    {
39
        $this->repository = $repository;
40
41
        parent::__construct();
42
    }
43
44
    /**
45
     * Execute the console command.
46
     */
47
    public function handle()
48
    {
49
        $result = $this->repository->upgradeFromRepo();
50
51
        if ($result) {
52
            $this->info('Games upgraded');
53
        } else {
54
            $this->error('Error while upgrading games');
55
        }
56
    }
57
}