Setup   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 6
dl 0
loc 25
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 18 1
1
<?php
2
3
namespace Nikaia\TranslationSheet\Commands;
4
5
use Illuminate\Console\Command;
6
use Nikaia\TranslationSheet\Sheet\TranslationsSheet;
7
use Nikaia\TranslationSheet\Spreadsheet;
8
9
class Setup extends Command
10
{
11
    protected $signature = 'translation_sheet:setup';
12
13 1
    protected $description = 'Setup spreadsheet and get it ready to host translations';
14
15 1
    public function handle(Spreadsheet $spreadsheet)
16 1
    {
17
        $spreadsheet->ensureConfiguredSheetsAreCreated();
18
19
        $spreadsheet->sheets()->each(function (TranslationsSheet $translationsSheet) {
20
            $this->output->writeln(
21
                '<comment>Setting up translations sheet [' . $translationsSheet->getTitle() . ']</comment>'
22
            );
23
24
            $translationsSheet->api()->addBatchRequests(
25
                $translationsSheet->api()->setTabColor($translationsSheet->getId(), $translationsSheet->getTabColor())
26
            );
27
        });
28
29
        $spreadsheet->api()->sendBatchRequests();
30
31
        $this->output->writeln('<info>Done. Spreasheet is ready.</info>');
32
    }
33
}
34