Completed
Push — master ( 3576d4...095dbc )
by Maxime
12s queued 11s
created

use_contentful_preview()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 8
nc 2
nop 1
dl 0
loc 11
ccs 0
cts 5
cp 0
crap 6
rs 10
c 1
b 0
f 0
1
<?php
2
3
if (! function_exists('use_contentful_preview')) {
4
    /**
5
     * Use Contentful preview switch setup.
6
     *
7
     * @param  boolean  $state
8
     * @return void
9
     */
10
    function use_contentful_preview(bool $state = true)
11
    {
12
        if (! empty($state)) {
13
            config([
14
                'database.default' => 'mysql_preview',
15
                'contentful.use_preview' => 1,
16
            ]);
17
        } else {
18
            config([
19
                'database.default' => 'mysql',
20
                'contentful.use_preview' => 0,
21
            ]);
22
        }
23
    }
24
}
25