Completed
Push — prototype ( 3bfdd7...aec713 )
by Peter
07:47
created

ConsoleShell   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 6 1
A handle() 0 13 1
1
<?php
2
/**
3
 * Webino (http://webino.sk)
4
 *
5
 * @link        https://github.com/webino for the canonical source repository
6
 * @copyright   Copyright (c) 2015-2017 Webino, s.r.o. (http://webino.sk)
7
 * @author      Peter Bačinský <[email protected]>
8
 * @license     BSD-3-Clause
9
 */
10
11
namespace WebinoAppLib\Console;
12
13
use Psy\Shell;
14
use WebinoAppLib\Event\ConsoleEvent;
15
use WebinoConfigLib\Feature\Route\ConsoleRoute;
16
17
/**
18
 * Class ConsoleRuntime
19
 */
20
class ConsoleShell extends AbstractConsoleCommand
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function configure(ConsoleRoute $route)
26
    {
27
        $route
28
            ->setPath('shell')
29
            ->setTitle('Run interactive PHP console');
30
    }
31
32
    /**
33
     * @param ConsoleEvent $event
34
     */
35
    public function handle(ConsoleEvent $event)
36
    {
37
        $sh = new Shell;
38
        $sh->setScopeVariables([
39
            'app' => $event->getApp(),
40
            'cli' => $event->getCli(),
41
        ]);
42
43
        $sh->setBoundObject($event->getCli());
44
        $sh->run();
45
46
        extract($sh->getScopeVariables(false));
0 ignored issues
show
Bug introduced by
$sh->getScopeVariables(false) cannot be passed to extract() as the parameter $var_array expects a reference.
Loading history...
47
    }
48
}
49