SharkPrinter::getSubscribedEvents()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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