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

MacroInlineVariableOutput::runVariableMacro()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ublaboo\Anabelle\Markdown\Macros;
6
7
final class MacroInlineVariableOutput 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->getInlineVariable($input[1]);
19
			},
20
			$content
21
		);
22
	}
23
}
24