Completed
Push — master ( 602963...93984f )
by Nassif
08:12
created

Open::openCmd()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 1
b 0
f 0
cc 2
eloc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace Nikaia\TranslationSheet\Commands;
4
5
use Illuminate\Console\Command;
6
use Nikaia\TranslationSheet\Spreadsheet;
7
8
class Open extends Command
9
{
10
    protected $signature = 'translation_sheet:open';
11
12
    protected $description = 'Open the spreadsheet in the browser';
13
14
    public function handle(Spreadsheet $spreadsheet)
15
    {
16
        $url = $spreadsheet->getUrl();
17
18
        $this->comment('Opening spreadsheet ' . $url);
19
20
        shell_exec($this->openCmd() . ' ' . $url);
21
    }
22
23
    protected function openCmd()
24
    {
25
        return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? 'start' : 'open';
26
    }
27
}
28