Code Duplication    Length = 14-16 lines in 2 locations

src/Kdyby/Translation/Latte/TranslateMacros.php 2 locations

@@ 50-63 (lines=14) @@
47
	public function macroTranslate(MacroNode $node, PhpWriter $writer)
48
	{
49
		if (class_exists('Latte\Runtime\FilterInfo')) { // Nette 2.4
50
			if ($node->closing) {
51
				return $writer->write('$_fi = new LR\FilterInfo(%var); echo %modifyContent($this->filters->filterContent("translate", $_fi, ob_get_clean()))', $node->context[0]);
52
53
			} elseif ($node->empty = ($node->args !== '')) {
54
				if ($this->containsOnlyOneWord($node)) {
55
					return $writer->write('echo %modify(call_user_func($this->filters->translate, %node.word))');
56
57
				} else {
58
					return $writer->write('echo %modify(call_user_func($this->filters->translate, %node.word, %node.args))');
59
				}
60
61
			} else {
62
				return 'ob_start(function () {})';
63
			}
64
65
		} else { // <= Nette 2.3
66
			if ($node->closing) {
@@ 65-80 (lines=16) @@
62
				return 'ob_start(function () {})';
63
			}
64
65
		} else { // <= Nette 2.3
66
			if ($node->closing) {
67
				return $writer->write('echo %modify($template->translate(ob_get_clean()))');
68
69
			} elseif ($node->isEmpty = ($node->args !== '')) {
70
				if ($this->containsOnlyOneWord($node)) {
71
					return $writer->write('echo %modify($template->translate(%node.word))');
72
73
				} else {
74
					return $writer->write('echo %modify($template->translate(%node.word, %node.args))');
75
				}
76
77
			} else {
78
				return 'ob_start()';
79
			}
80
		}
81
	}
82
83