Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
94.74% covered (success)
94.74%
18 / 19
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
Index
94.74% covered (success)
94.74%
18 / 19
50.00% covered (danger)
50.00%
1 / 2
7.01
0.00% covered (danger)
0.00%
0 / 1
 run
83.33% covered (warning)
83.33%
5 / 6
0.00% covered (danger)
0.00%
0 / 1
2.02
 showInfo
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
1 / 1
5
1<?php declare(strict_types=1);
2/*
3 * This file is part of Aplus Command Line Tool.
4 *
5 * (c) Natan Felles <natanfelles@gmail.com>
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10namespace Aplus\Commands;
11
12use Aplus;
13use Framework\CLI\CLI;
14
15/**
16 * Class Index.
17 *
18 * @package aplus
19 */
20class Index extends \Framework\CLI\Commands\Index
21{
22    public function run() : void
23    {
24        $this->showHeader();
25        $this->showDate();
26        $this->showInfo();
27        if ($this->console->getOption('g')) {
28            $this->greet();
29        }
30        $this->listCommands();
31    }
32
33    protected function showInfo() : void
34    {
35        $distro = \PHP_OS_FAMILY;
36        if ($distro === 'Linux' && \is_file('/etc/lsb-release')) {
37            $contents = \file_get_contents('/etc/lsb-release');
38            if ($contents) {
39                $lsb = (array) \parse_ini_string($contents);
40                if (isset($lsb['DISTRIB_ID'], $lsb['DISTRIB_RELEASE'])) {
41                    $distro = $lsb['DISTRIB_ID'] . ' ' . $lsb['DISTRIB_RELEASE'];
42                }
43            }
44        }
45        CLI::write(
46            'Running Aplus ' . Aplus::VERSION
47            . ' on ' . $distro
48            . ' with PHP ' . \PHP_VERSION
49        );
50        CLI::newLine();
51    }
52}