Completed
Pull Request — master (#5)
by
unknown
02:59
created

StringValue   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 28
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCompiled() 0 11 3
A initializeFromOldFormat() 0 5 1
1
<?php
2
namespace LesserPhp\Compiler\Value;
3
4
/**
5
 * lesserphp
6
 * https://www.maswaba.de/lesserphp
7
 *
8
 * LESS CSS compiler, adapted from http://lesscss.org
9
 *
10
 * Copyright 2013, Leaf Corcoran <[email protected]>
11
 * Copyright 2016, Marcus Schwarz <[email protected]>
12
 * Copyright 2017, Stefan Pöhner <[email protected]>
13
 * Licensed under MIT or GPLv3, see LICENSE
14
 *
15
 * @package LesserPhp
16
 */
17
18
class StringValue extends AbstractValue
19
{
20
	private $delimiter, $content;
0 ignored issues
show
Coding Style introduced by
It is generally advisable to only define one property per statement.

Only declaring a single property per statement allows you to later on add doc comments more easily.

It is also recommended by PSR2, so it is a common style that many people expect.

Loading history...
21
22
	/**
23
	 * @inheritdoc
24
	 */
25 27
	public function getCompiled()
26
	{
27 27
		$content = $this->content;
28 27
		foreach ($content as &$part) {
29 27
			if (is_array($part)) {
30 27
				$part = $this->compiler->compileValue($part);
31
			}
32
		}
33
34 27
		return $this->delimiter . implode($content) . $this->delimiter;
35
	}
36
37
	/**
38
	 * @inheritdoc
39
	 */
40 27
	public function initializeFromOldFormat(array $value)
41
	{
42 27
		$this->delimiter=$value[1];
43 27
		$this->content=$value[2];
44
	}
45
}