IncrementCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 12
c 1
b 0
f 1
dl 0
loc 22
ccs 9
cts 9
cp 1
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 15 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Vasoft\LaravelVersionIncrement\Commands;
6
7
use Illuminate\Console\Command;
8
use Vasoft\LaravelVersionIncrement\Exceptions\ModuleException;
9
10
class IncrementCommand extends Command
11
{
12
    protected $signature = 'vs-version:increment
13
                            {type? : One of: major, minor, patch, or leave empty for auto}';
14
15
    protected $description = 'Increment project version using voral/vs-version-increment';
16
17 5
    public function handle(?CommandRunner $runner = null): int
18
    {
19 5
        $runner ??= new CommandRunner();
20 5
        $type = is_string($this->argument('type')) ? $this->argument('type') : '';
21
22
        try {
23 5
            $runner->increment($type);
24 4
            $this->output->write($runner->getLastOutput());
25 1
        } catch (ModuleException $e) {
26 1
            $this->error($e->getMessage());
27
28 1
            return self::FAILURE;
29
        }
30
31 4
        return self::SUCCESS;
32
    }
33
}
34