Completed
Push — master ( d9680d...b26789 )
by Pavel
09:43
created

MacroBlockVariableOutput   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A runVariableMacro() 0 13 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ublaboo\Anabelle\Markdown\Macros;
6
7
final class MacroBlockVariableOutput extends AbstractMacroVariable implements IMacro
8
{
9
10
	protected function runVariableMacro(string & $content): void // Intentionally &
11
	{
12
		/**
13
		 * Remove lines with inline variables definition and put then into DocuScope
14
		 */
15
		$content = preg_replace_callback(
16
			'/\{\$\$([a-zA-Z_0-9]+)\}/m',
17
			function(array $input): string {
18
				return $this->docuScope->getBlockVariable($input[1]);
19
			},
20
			$content
21
		);
22
	}
23
}
24