Completed
Push — master ( 89313f...8b5ee1 )
by Nassif
02:33
created

Prepare   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 20
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 13 1
1
<?php
2
3
namespace Nikaia\TranslationSheet\Commands;
4
5
use Illuminate\Console\Command;
6
use Nikaia\TranslationSheet\Pusher;
7
use Nikaia\TranslationSheet\Spreadsheet;
8
use Nikaia\TranslationSheet\Translation\Writer;
9
use Nikaia\TranslationSheet\Util;
10
11
class Prepare extends Command
12
{
13
    protected $signature = 'translation_sheet:prepare';
14
15
    protected $description = 'Rewrite locales languages files by removing comments and sorting keys. This most likely reduce and simplify conflicts when pulling translations from spreadsheet.';
16
17 1
    public function handle(Pusher $pusher, Spreadsheet $spreadsheet, Writer $writer)
18
    {
19 1
        $this->output->writeln('<comment>Scanning local languages files</comment>');
20 1
        $translations = Util::keyValues(
21 1
            $pusher->getScannedAndTransformedTranslations(),
22 1
            $spreadsheet->getCamelizedHeader()
23
        );
24
25 1
        $this->output->writeln('<comment>Rewriting :</comment>');
26 1
        $writer->withOutput($this->output)->setTranslations($translations)->write();
27
28 1
        $this->output->writeln('<info>Done.</info>');
29 1
    }
30
}
31