SqliteEnv   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A sqliteEnv() 0 13 3
1
<?php
2
3
namespace Acacha\Llum\Traits;
4
5
use Symfony\Component\Console\Output\OutputInterface;
6
7
/**
8
 * Class SqliteEnv.
9
 *
10
 * @property OutputInterface $output
11
 */
12
trait SqliteEnv
13
{
14
    /**
15
     * Config .env file.
16
     */
17
    protected function sqliteEnv()
18
    {
19
        passthru('sed -i \'s/^DB_/#DB_/g\' .env ', $error);
20
        if ($error !== 0) {
21
            $this->output->writeln('<error>Error commenting DB_ entries in .env file </error>');
22
        }
23
        passthru('sed -i \'s/.*DB_HOST.*/DB_CONNECTION=sqlite\n&/\' .env', $error);
24
        if ($error !== 0) {
25
            $this->output->writeln('<error>Error adding DB_CONNECTION=sqlite to .env file </error>');
26
        } else {
27
            $this->output->writeln('.env file updated successfully');
28
        }
29
    }
30
}
31