Completed
Push — master ( 7bae76...0958d1 )
by Vladimir
9s
created

SourceMapGenerator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getSourceMapContents() 0 4 1
A saveMap() 0 6 1
1
<?php
2
3
/**
4
 * @copyright 2018 Vladimir Jimenez
5
 * @license   https://github.com/stakx-io/stakx/blob/master/LICENSE.md MIT
6
 */
7
8
namespace allejo\stakx\AssetEngine\Sass;
9
10
use Leafo\ScssPhp\SourceMap\SourceMapGenerator as BaseGenerator;
11
12
/**
13
 * A custom SourceMapGenerator to override the one provided by ScssPhp.
14
 *
15
 * This version stores the content of its source map and makes it available for a later time. This class allows us to
16
 * give the source map to our stakx Compiler to write out instead of letting ScssPhp do that.
17
 */
18
class SourceMapGenerator extends BaseGenerator
19
{
20
    protected $generatorOptions;
21
    protected $sourceMapContent;
22
23 1
    public function __construct(array $options = [])
24
    {
25 1
        parent::__construct($options);
26
27 1
        $this->generatorOptions = $options;
28 1
    }
29
30 1
    public function getSourceMapContents()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
31
    {
32 1
        return $this->sourceMapContent;
33
    }
34
35 1
    public function saveMap($content)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
36
    {
37 1
        $this->sourceMapContent = $content;
38
39 1
        return $this->generatorOptions['sourceMapURL'];
40
    }
41
}
42