Passed
Push — master ( d2ebdc...958928 )
by Bogdan
05:05
created

ColdExecutionContext   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 27
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getWrapper() 0 4 1
A warm() 0 4 1
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of the pinepain/js-sandbox PHP library.
5
 *
6
 * Copyright (c) 2016-2017 Bogdan Padalko <[email protected]>
7
 *
8
 * Licensed under the MIT license: http://opensource.org/licenses/MIT
9
 *
10
 * For the full copyright and license information, please view the
11
 * LICENSE file that was distributed with this source or visit
12
 * http://opensource.org/licenses/MIT
13
 */
14
15
16
namespace Pinepain\JsSandbox\Wrappers\FunctionComponents\Runtime;
17
18
19
use Pinepain\JsSandbox\Specs\FunctionSpecInterface;
20
use Pinepain\JsSandbox\Wrappers\Runtime\RuntimeFunction;
21
use Pinepain\JsSandbox\Wrappers\WrapperInterface;
22
use V8\FunctionCallbackInfo;
23
24
25
class ColdExecutionContext implements ColdExecutionContextInterface
26
{
27
    /**
28
     * @var WrapperInterface
29
     */
30
    private $wrapper;
31
    /**
32
     * @var RuntimeFunction
33
     */
34
    private $runtime_function;
35
36
    public function __construct(WrapperInterface $wrapper, RuntimeFunction $runtime_function)
37
    {
38
        $this->wrapper          = $wrapper;
39
        $this->runtime_function = $runtime_function;
40
    }
41
42
    public function getWrapper(): WrapperInterface
43
    {
44
        return $this->wrapper;
45
    }
46
47
    public function warm(FunctionCallbackInfo $args, FunctionSpecInterface $spec): ExecutionContextInterface
48
    {
49
        return new ExecutionContext($this->wrapper, $this->runtime_function, $args, $spec);
50
    }
51
}
52