AbstractMacroVariable   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 61
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A runMacro() 0 8 1
runVariableMacro() 0 4 ?
A getMacrosToRunOnBlockVariables() 0 9 1
A getMacrosToRunOnInlineVariables() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ublaboo\Anabelle\Markdown\Macros;
6
7
use Ublaboo\Anabelle\Generator\Exception\DocuGeneratorException;
8
use Ublaboo\Anabelle\Markdown\DocuScope;
9
10
abstract class AbstractMacroVariable
11
{
12
13
	protected const MAX_EXECUTE_DEPTH = 3;
14
15
	/**
16
	 * @var DocuScope
17
	 */
18
	protected $docuScope;
19
20
21
	public function __construct(DocuScope $docuScope)
22
	{
23
		$this->docuScope = $docuScope;
24
	}
25
26
27
	/**
28
	 * @throws DocuGeneratorException
29
	 */
30
	public function runMacro(
31
		string $inputDirectory,
0 ignored issues
show
Unused Code introduced by
The parameter $inputDirectory is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
32
		string $outputDirectory,
0 ignored issues
show
Unused Code introduced by
The parameter $outputDirectory is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
33
		string & $content // Intentionally &
34
	): void
35
	{
36
		$this->runVariableMacro($content, 1);
37
	}
38
39
40
	abstract protected function runVariableMacro(
41
		string & $content,
42
		int $depth
43
	): void; // Intentionally &
44
45
46
	/**
47
	 * @return AbstractMacroVariable[]
48
	 */
49
	protected function getMacrosToRunOnBlockVariables(): array
50
	{
51
		return [
52
			new MacroInlineVariable($this->docuScope),
53
			new MacroInlineVariableOutput($this->docuScope),
54
			new MacroBlockVariable($this->docuScope),
55
			new MacroBlockVariableOutput($this->docuScope),
56
		];
57
	}
58
59
60
	/**
61
	 * @return AbstractMacroVariable[]
62
	 */
63
	protected function getMacrosToRunOnInlineVariables(): array
64
	{
65
		return [
66
			new MacroInlineVariable($this->docuScope),
67
			new MacroInlineVariableOutput($this->docuScope),
68
		];
69
	}
70
}
71