MacroInlineVariable::runVariableMacro()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 7

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
dl 15
loc 15
rs 9.4285
c 0
b 0
f 0
nc 1
cc 1
eloc 7
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ublaboo\Anabelle\Markdown\Macros;
6
7 View Code Duplication
final class MacroInlineVariable extends AbstractMacroVariable implements IMacro
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
10
	protected function runVariableMacro(string & $content, int $depth): 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
				$this->docuScope->addInlineVariable($input[1], $input[2]);
19
20
				return '';
21
			},
22
			$content
23
		);
24
	}
25
}
26