GeneratorCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDatabaseName() 0 7 1
A blockMessage() 0 8 1
A sectionMessage() 0 9 1
1
<?php namespace Nwidart\DbExporter\Commands;
2
3
use Illuminate\Console\Command;
4
use Config;
5
6
class GeneratorCommand extends Command
7
{
8
    /**
9
     * Get the database name from the app/config/database.php file
10
     * @return String
11
     */
12
    protected function getDatabaseName()
13
    {
14
        $connType = config('database.default');
15
        $database = config('database.connections.' .$connType );
16
17
        return $database['database'];
18
    }
19
20
    protected function blockMessage($title, $message, $style = 'info')
21
    {
22
        // Symfony style block messages
23
        $formatter = $this->getHelperSet()->get('formatter');
24
        $errorMessages = array($title, $message);
25
        $formattedBlock = $formatter->formatBlock($errorMessages, $style, true);
26
        $this->line($formattedBlock);
27
    }
28
29
    protected function sectionMessage($title, $message)
30
    {
31
        $formatter = $this->getHelperSet()->get('formatter');
32
        $formattedLine = $formatter->formatSection(
33
            $title,
34
            $message
35
        );
36
        $this->line($formattedLine);
37
    }
38
}