Completed
Pull Request — master (#21)
by Théo
05:49 queued 02:07
created

Psysh::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of the PsyshBundle package.
5
 *
6
 * (c) Théo FIDRY <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Fidry\PsyshBundle\DependencyInjection;
13
14
use Psy\Shell;
15
16
/**
17
 * @author Théo FIDRY <[email protected]>
18
 */
19
final class Psysh
20
{
21
    /**
22
     * @var Shell
23
     */
24
    private static $shell;
25
26 6
    public static function init(Shell $shell)
27
    {
28 6
        static::$shell = $shell;
0 ignored issues
show
Comprehensibility introduced by
Since Fidry\PsyshBundle\DependencyInjection\Psysh is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
29 6
    }
30
31
    public static function debug(array $variables = [], $bind = null)
32
    {
33
        extract(
34
            static::$shell->debug(
0 ignored issues
show
Bug introduced by
static::$shell->debug(ar...(), $variables), $bind) cannot be passed to extract() as the parameter $var_array expects a reference.
Loading history...
Comprehensibility introduced by
Since Fidry\PsyshBundle\DependencyInjection\Psysh is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
35
                array_merge(static::$shell->getScopeVariables(), $variables),
0 ignored issues
show
Comprehensibility introduced by
Since Fidry\PsyshBundle\DependencyInjection\Psysh is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
36
                $bind
37
            )
38
        );
39
    }
40
41
    public static function getInstance()
42
    {
43
        return static::$shell;
0 ignored issues
show
Comprehensibility introduced by
Since Fidry\PsyshBundle\DependencyInjection\Psysh is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
44
    }
45
}
46