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

MacroInlineVariableOutput::runMacro()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 10

Duplication

Lines 17
Ratio 100 %

Importance

Changes 0
Metric Value
dl 17
loc 17
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 3
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