NoCommitCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 12
c 2
b 0
f 1
dl 0
loc 21
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 NoCommitCommand extends Command
11
{
12
    protected $signature = 'vs-version:no-commit
13
                            {type? : One of: major, minor, patch, or leave empty for auto}';
14
    protected $description = 'Process without making a commit and version tag';
15
16 5
    public function handle(?CommandRunner $runner = null): int
17
    {
18 5
        $runner ??= new CommandRunner();
19 5
        $type = is_string($this->argument('type')) ? $this->argument('type') : '';
20
21
        try {
22 5
            $runner->noCommit($type);
23 4
            $this->output->write($runner->getLastOutput());
24 1
        } catch (ModuleException $e) {
25 1
            $this->error($e->getMessage());
26
27 1
            return self::FAILURE;
28
        }
29
30 4
        return self::SUCCESS;
31
    }
32
}
33