Completed
Push — 1.x ( c183a4...05b51a )
by Alexander
8s
created

BaseSourceTransformer::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 2
crap 2
1
<?php
2
/*
3
 * Go! AOP framework
4
 *
5
 * @copyright Copyright 2013, Lisachenko Alexander <[email protected]>
6
 *
7
 * This source file is subject to the license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Go\Instrument\Transformer;
12
13
use Go\Core\AspectKernel;
14
use Go\Core\AspectContainer;
15
16
/**
17
 * Base source transformer class definition
18
 */
19
abstract class BaseSourceTransformer implements SourceTransformer
20
{
21
22
    /**
23
     * Transformer options
24
     *
25
     * @var array
26
     */
27
    protected $options = [];
28
29
    /**
30
     * @var AspectKernel|null
31
     */
32
    protected $kernel = null;
33
34
    /**
35
     * @var AspectContainer|null
36
     */
37
    protected $container = null;
38
39
    /**
40
     * Default constructor for transformer
41
     *
42
     * @param AspectKernel $kernel Instance of aspect kernel
43
     * @param array $options Custom options or kernel options
44
     */
45 14
    public function __construct(AspectKernel $kernel, array $options = [])
46
    {
47 14
        $this->kernel    = $kernel;
48 14
        $this->container = $kernel->getContainer();
49 14
        $this->options   = $options ?: $kernel->getOptions();
50 14
    }
51
}
52