1: <?php
2:
3: /**
4: * This file is part of the Latte (https://latte.nette.org)
5: * Copyright (c) 2008 David Grudl (https://davidgrudl.com)
6: */
7:
8: namespace Latte;
9:
10:
11: /**
12: * Macro element node.
13: */
14: class MacroNode extends Object
15: {
16: const PREFIX_INNER = 'inner',
17: PREFIX_TAG = 'tag',
18: PREFIX_NONE = 'none';
19:
20: /** @var IMacro */
21: public $macro;
22:
23: /** @var string */
24: public $name;
25:
26: /** @var bool */
27: public $isEmpty = FALSE;
28:
29: /** @var string raw arguments */
30: public $args;
31:
32: /** @var string raw modifier */
33: public $modifiers;
34:
35: /** @var bool */
36: public $closing = FALSE;
37:
38: /** @var bool has output? */
39: public $replaced;
40:
41: /** @var MacroTokens */
42: public $tokenizer;
43:
44: /** @var MacroNode */
45: public $parentNode;
46:
47: /** @var string */
48: public $openingCode;
49:
50: /** @var string */
51: public $closingCode;
52:
53: /** @var string */
54: public $attrCode;
55:
56: /** @var string */
57: public $content;
58:
59: /** @var \stdClass user data */
60: public $data;
61:
62: /** @var HtmlNode closest HTML node */
63: public $htmlNode;
64:
65: /** @var string indicates n:attribute macro and type of prefix (PREFIX_INNER, PREFIX_TAG, PREFIX_NONE) */
66: public $prefix;
67:
68: public $saved;
69:
70:
71: public function __construct(IMacro $macro, $name, $args = NULL, $modifiers = NULL, self $parentNode = NULL, HtmlNode $htmlNode = NULL, $prefix = NULL)
72: {
73: $this->macro = $macro;
74: $this->name = (string) $name;
75: $this->modifiers = (string) $modifiers;
76: $this->parentNode = $parentNode;
77: $this->htmlNode = $htmlNode;
78: $this->prefix = $prefix;
79: $this->data = new \stdClass;
80: $this->setArgs($args);
81: }
82:
83:
84: public function setArgs($args)
85: {
86: $this->args = (string) $args;
87: $this->tokenizer = new MacroTokens($this->args);
88: }
89:
90: }
91: