Sync::handle()   A
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 20
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 10
c 1
b 0
f 0
nc 8
nop 0
dl 0
loc 20
ccs 0
cts 15
cp 0
crap 20
rs 9.9332
1
<?php
2
3
namespace Distilleries\Contentful\Commands\Sync;
4
5
use Illuminate\Console\Command;
6
7
class Sync extends Command
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12
    protected $signature = 'contentful:sync {--preview} {--no-switch} {--no-truncate}';
13
14
    /**
15
     * {@inheritdoc}
16
     */
17
    protected $description = 'Synchronize Contentful process (locales, raw fetch, map and persist)';
18
19
    /**
20
     * Execute the console command.
21
     *
22
     * @return void
23
     */
24
    public function handle()
25
    {
26
        $arguments = [];
27
        if ($this->option('preview')) {
28
            $arguments['--preview'] = true;
29
        }
30
31
        $this->call('contentful:sync-locales', $arguments);
32
33
        $this->call('contentful:sync-data', $arguments);
34
35
        if ($this->option('no-switch')) {
36
            $arguments['--no-switch'] = true;
37
        }
38
39
        if ($this->option('no-truncate')) {
40
            $arguments['--no-truncate'] = true;
41
        }
42
43
        $this->call('contentful:sync-flatten', $arguments);
44
    }
45
}
46