Basics::status()   B
last analyzed

Complexity

Conditions 6
Paths 6

Size

Total Lines 23
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 13
nc 6
nop 0
dl 0
loc 23
rs 8.5906
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of the Divergence package.
4
 *
5
 * (c) Henry Paradiz <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace Divergence\CLI\Controllers\Commands;
11
12
use Divergence\CLI\Env;
13
use Divergence\CLI\Command;
14
15
class Basics
16
{
17
    public static function version()
18
    {
19
        $climate = Command::getClimate();
20
        $climate->out('Divergence Command Line Tool');
21
    }
22
23
    public static function status()
24
    {
25
        $climate = Command::getClimate();
26
27
        if (!Env::$hasComposer) {
28
            $climate->backgroundYellow()->black()->out("No composer.json detected.");
29
            return;
30
        }
31
32
        $climate->info(sprintf('Found %s', Env::$package['name']));
33
        
34
        if (!Env::$isRequired && !Env::$isRequireDev) {
35
            $climate->backgroundYellow()->black()->out('Did not find divergence/divergence in composer.json require');
36
            $climate->backgroundYellow()->black()->out('Run divergence init to bootstrap your project');
37
            return;
38
        }
39
40
        if (Env::$isRequired) {
41
            $climate->info('Found divergence/divergence in composer.json require');
42
        }
43
44
        if (Env::$isRequireDev) {
45
            $climate->info('Found divergence/divergence in composer.json require-dev');
46
        }
47
    }
48
    public static function usage()
49
    {
50
        $climate = Command::getClimate();
51
        static::version();
52
        $climate->out('');
53
        $climate->out(" divergence [command] [arguments]");
54
        $climate->out('');
55
        $climate->out('');
56
        $climate->bold("\tAvailable Arguments");
57
        $climate->out("\t--version, -v\t\tVersion information");
58
        $climate->out('');
59
        $climate->out("\thelp, --help, -h\tThis help information");
60
        $climate->out('');
61
        $climate->bold("\tAvailable Commands");
62
        $climate->out('');
63
        $climate->out("\tinit\t\tBootstraps a new Divergence project.");
64
        $climate->out("\tstatus\t\tShows information on the current project.");
65
        $climate->out('');
66
        $climate->out("\tconfig\t\tdatabase\tReconfigure database setting.");
67
        //$climate->out("\tbuild\t\tA suite of commands for automatically building project components.");
68
        $climate->out('');
69
        $climate->out("\ttest [subcommand]\t\t");
70
        $climate->out("\t     dbconfig\tChecks if DB config works. Asks you to choose a label name or provide one as the next argument.");
71
    }
72
}
73