RebindViewContainer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 33
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 13 1
1
<?php
2
3
namespace SwooleTW\Http\Server\Resetters;
4
5
use Illuminate\Contracts\Container\Container;
6
use SwooleTW\Http\Server\Sandbox;
7
8
class RebindViewContainer implements ResetterContract
9
{
10
    /**
11
     * @var Container
12
     */
13
    protected $container;
14
15
    /**
16
     * @var array
17
     */
18
    protected $shared;
19
20
    /**
21
     * "handle" function for resetting app.
22
     *
23
     * @param \Illuminate\Contracts\Container\Container $app
24
     * @param \SwooleTW\Http\Server\Sandbox $sandbox
25
     *
26
     * @return \Illuminate\Contracts\Container\Container
27
     */
28
    public function handle(Container $app, Sandbox $sandbox)
29
    {
30
        $view = $app->make('view');
31
32
        $closure = function () use ($app) {
33
            $this->container = $app;
34
            $this->shared['app'] = $app;
35
        };
36
37
        $resetView = $closure->bindTo($view, $view);
38
        $resetView();
39
40
        return $app;
41
    }
42
}
43