HelloWorld   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 7 1
A execute() 0 6 2
1
<?php namespace Tarsana\Command\Examples;
2
3
use Tarsana\Command\Command;
4
5
class HelloWorld extends Command {
6
7
    protected function init ()
8
    {
9
        $this->name('Hello World')
10
             ->version('1.0.0-alpha')
11
             ->description('Shows a "Hello World" message')
12
             ->options(['--formal'])
13
             ->describe('--formal', 'Use formal "Greetings" instead of "Hello"');
14
    }
15
16
    protected function execute()
17
    {
18
        $greeting = $this->option('--formal') ? 'Greetings' : 'Hello';
19
        $this->console->out('Your name: ');
20
        $name = $this->console->readLine();
21
        $this->console->line("{$greeting} {$name}");
22
    }
23
24
}
25