Completed
Push — master ( 8ef6fd...e63308 )
by Alessandro
02:30
created

SharkPrinter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Paraunit\Printer;
5
6
use Paraunit\Bin\Paraunit;
7
use Paraunit\Lifecycle\EngineEvent;
8
use Symfony\Component\Console\Output\OutputInterface;
9
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
10
11
/**
12
 * Class SharkPrinter
13
 * @package Paraunit\Printer
14
 */
15
class SharkPrinter extends AbstractPrinter implements EventSubscriberInterface
16
{
17
    /** @var bool */
18
    private $showLogo;
19
20
    /**
21
     * SharkPrinter constructor.
22
     * @param OutputInterface $output
23
     * @param bool $showLogo
24
     */
25 17
    public function __construct(OutputInterface $output, bool $showLogo)
26
    {
27 17
        parent::__construct($output);
28
29 17
        $this->showLogo = $showLogo;
30
    }
31
32 58
    public static function getSubscribedEvents(): array
33
    {
34
        return [
35 58
            EngineEvent::BEFORE_START => ['onEngineBeforeStart', 1000],
36
        ];
37
    }
38
39 17
    public function onEngineBeforeStart()
40
    {
41 17
        $output = $this->getOutput();
42
43 17
        if ($this->showLogo) {
44 1
            $output->writeln('                                                   B>                           ');
45 1
            $output->writeln('                                                   B "Bp                        ');
46 1
            $output->writeln('.pp..                                              B    9p                      ');
47 1
            $output->writeln(' "9BBBBBBpp.                                       B      9p                    ');
48 1
            $output->writeln('    " ""9BBBBBBpp                          .<eeP"B B      .B b                  ');
49 1
            $output->writeln('           "SANDROBpp              .     B B     B B      )B B                  ');
50 1
            $output->writeln('              "BFRABBBB>  .<pe6P\B B     B B     B B      $  B     .e           ');
51 1
            $output->writeln('                 5NICOBBB B     ·B B     B B     B Bqp.  :B  B     $ 4BBpp      ');
52 1
            $output->writeln('                   BMIKIB B        B     B B     B B   "^Bp  B    ) |BBB"\BBpp. ');
53 1
            $output->writeln('                 .BALEBBB """9q.   B"""""B B"""""B B      1p B""""9p BBBBbBBBBBBB');
54 1
            $output->writeln('               <BLUCABBBB B    "B  B     B B     B B       B B     9 9BBB< ^P"  ');
55 1
            $output->writeln('            .6BSERGIOBBBB B666666B B     B B     B B       9 P      7 9BBBBP    ');
56
        }
57
58 17
        $output->writeln('');
59 17
        $output->writeln('PARAUNIT v.' . Paraunit::getVersion());
60 17
        $output->writeln('by Francesco Panina, Alessandro Lai & Shark Dev Team @ Facile.it');
61
    }
62
}
63