Application   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 29
ccs 0
cts 21
cp 0
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 27 4
1
<?php namespace Todaymade\Daux\Console;
2
3
use Symfony\Component\Console\Application as SymfonyApplication;
4
5
class Application extends SymfonyApplication
6
{
7
    public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
8
    {
9
        parent::__construct($name, $version);
10
11
        $this->add(new Generate());
12
        $this->add(new Serve());
13
        $this->add(new ClearCache());
14
15
        $app_name = "daux/daux.io";
16
17
        $up = '..' . DIRECTORY_SEPARATOR;
18
        $composer = __DIR__ . DIRECTORY_SEPARATOR . $up . $up . $up . $up . $up . 'composer.lock';
19
        $version = "unknown";
20
21
        if (file_exists($composer)) {
22
            $app = json_decode(file_get_contents($composer));
23
            $packages = $app->packages;
24
            
25
            foreach ($packages as $package) {
26
                if ($package->name == $app_name) {
27
                    $version = $package->version;
28
                }
29
            }
30
        }
31
32
        $this->setVersion($version);
33
        $this->setName($app_name);
34
    }
35
}
36