Completed
Push — prototype ( 3bfdd7...aec713 )
by Peter
07:47
created

ConsoleCredits::handle()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 27
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 18
nc 2
nop 1
dl 0
loc 27
rs 8.8571
c 0
b 0
f 0
1
<?php
2
/**
3
 * Webino (http://webino.sk)
4
 *
5
 * @link        https://github.com/webino for the canonical source repository
6
 * @copyright   Copyright (c) 2015-2017 Webino, s.r.o. (http://webino.sk)
7
 * @author      Peter Bačinský <[email protected]>
8
 * @license     BSD-3-Clause
9
 */
10
11
namespace WebinoAppLib\Console;
12
13
use WebinoAppLib\Event\ConsoleEvent;
14
use WebinoAppLib\Service\Credits;
15
use WebinoConfigLib\Feature\Route\ConsoleRoute;
16
17
/**
18
 * Class ConsoleCredits
19
 */
20
class ConsoleCredits extends AbstractConsoleCommand
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function configure(ConsoleRoute $route)
26
    {
27
        $route
28
            ->setPath('credits')
29
            ->setTitle('Show credits');
30
    }
31
32
    /**
33
     * @param ConsoleEvent $event
34
     */
35
    public function handle(ConsoleEvent $event)
36
    {
37
        $cli = $event->getCli();
38
        $cli->flank('Credits')->br();
39
40
        /** @var Credits $credits */
41
        $credits = $event->getApp()->get(Credits::class);
42
43
        // third-party
44
        foreach ($credits->getCredits(__DIR__ . '/../../../vendor') as $item) {
45
            $cli->bold($item[0])->whisper($item[1]);
46
        }
47
48
        $note = 'Webino™ is brought to you thanks to authors and contributors '
49
              . 'of above third-party libraries also.';
50
51
        $cli
52
            ->border()
53
            ->comment($note)
54
            ->border()->br()
55
            ->bold()->inline(Credits::VENDOR_COPYRIGHT)
56
            ->out(' (' . Credits::VENDOR_URL . ')')
57
            ->bold()->inline('Author: ')
58
            ->whisper()->inline(Credits::AUTHOR_NAME)
59
            ->out(' (' . Credits::AUTHOR_URL . ')')
60
            ->br();
61
    }
62
}
63