Completed
Push — master ( b3b6a4...b2f402 )
by Sergi Tur
03:43
created

PackageListCommand::parsePackageInfo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Acacha\Llum\Console;
4
5
/**
6
 * Class PackageListCommand.
7
 */
8
class PackageListCommand extends LlumCommand
9
{
10
    /**
11
     * Command name.
12
     *
13
     * @var string
14
     */
15
    protected $commandName = 'package:list';
16
17
    /**
18
     * Command description.
19
     *
20
     * @var string
21
     */
22
    protected $commandDescription = 'Shows available packages to list (info taken from config/packages.php)';
23
24
    /**
25
     * Method to execute.
26
     *
27
     * @var string
28
     */
29
    protected $method = 'packageList';
30
31
    /**
32
     * Shows list of supported packages.
33
     */
34
    protected function packageList()
35
    {
36
        $packages = $this->config->all();
37
        foreach ($packages as $name => $package) {
38
            $this->output->writeln('<info>'.$name.'</info> | '.$this->parsePackageInfo($package));
39
        }
40
    }
41
42
    /**
43
     * Parse package info.
44
     *
45
     * @param $package
46
     *
47
     * @return string
48
     */
49
    private function parsePackageInfo($package)
50
    {
51
        return 'Composer name: '.$package[ 'name' ];
52
    }
53
}
54