Completed
Push — master ( ad12aa...1c1eb2 )
by De Cramer
10s
created

Application::executeRun()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 17
Code Lines 10

Duplication

Lines 8
Ratio 47.06 %

Code Coverage

Tests 11
CRAP Score 3

Importance

Changes 0
Metric Value
dl 8
loc 17
rs 9.4285
c 0
b 0
f 0
ccs 11
cts 11
cp 1
cc 3
eloc 10
nc 2
nop 0
crap 3
1
<?php
2
3
namespace eXpansion\Framework\Core\Services;
4
5
use eXpansion\Framework\Core\Services\Application\AbstractApplication;
6
use Symfony\Component\Console\Output\OutputInterface;
7
8
/**
9
 * eXpansion Application main routine.
10
 *
11
 * @package eXpansion\Framework\Core\Services
12
 */
13
class Application extends AbstractApplication {
14
15
    /** Base eXpansion callbacks. */
16
    const EVENT_PRE_LOOP = "expansion.pre_loop";
17
    const EVENT_POST_LOOP = "expansion.post_loop";
18
19
    /**
20
     * Initialize eXpansion.
21
     *
22
     * @param OutputInterface $console
23
     *
24
     * @return $this
25
     */
26 1
    public function init(OutputInterface $console)
27
    {
28 1
        parent::init($console);
29
30 1
        $this->console->writeln('$fff            8b        d8$fff              $0d0   ad888888b, ');
31 1
        $this->console->writeln('$fff             Y8,    ,8P $fff              $0d0  d8"     "88 ');
32 1
        $this->console->writeln('$fff              `8b  d8\' $fff               $0d0          a8  ');
33 1
        $this->console->writeln('$fff ,adPPYba,      Y88P    $fff  8b,dPPYba,  $0d0       ,d8P"  ');
34 1
        $this->console->writeln('$fffa8P_____88      d88b    $fff  88P\'    "8a $0d0     a8P"     ');
35 1
        $this->console->writeln('$fff8PP"""""""    ,8P  Y8,  $fff  88       d8 $0d0   a8P\'      ');
36 1
        $this->console->writeln('$fff"8b,   ,aa   d8\'    `8b$fff   88b,   ,a8" $0d0  d8"         ');
37 1
        $this->console->writeln('$fff `"Ybbd8"\'  8P        Y8$fff  88`YbbdP"\'  $0d0  88888888888');
38 1
        $this->console->writeln('$fff                        $fff  88          $0d0                ');
39 1
        $this->console->writeln('$777  eXpansion v.2.0.0.0   $fff  88          $0d0               ');
40
41 1
        return $this;
42
    }
43
44
45 1
    protected function executeRun()
46
    {
47 1
        $this->dispatcher->dispatch(self::EVENT_PRE_LOOP, []);
48
49 1
        $calls = $this->connection->executeCallbacks();
50 1 View Code Duplication
        if (!empty($calls)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
51 1
            foreach ($calls as $call) {
52 1
                $method = preg_replace('/^[[:alpha:]]+\./', '', $call[0]); // remove trailing "Whatever."
53 1
                $params = (array) $call[1];
54
55 1
                $this->dispatcher->dispatch($method, $params);
56
            }
57
        }
58
59 1
        $this->connection->executeMulticall();
60 1
        $this->dispatcher->dispatch(self::EVENT_POST_LOOP, []);
61 1
    }
62
}
63