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: * @author David Grudl
15: */
16: class MacroNode extends Object
17: {
18: const PREFIX_INNER = 'inner',
19: PREFIX_TAG = 'tag',
20: PREFIX_NONE = 'none';
21:
22: /** @var IMacro */
23: public $macro;
24:
25: /** @var string */
26: public $name;
27:
28: /** @var bool */
29: public $isEmpty = FALSE;
30:
31: /** @var string raw arguments */
32: public $args;
33:
34: /** @var string raw modifier */
35: public $modifiers;
36:
37: /** @var bool */
38: public $closing = FALSE;
39:
40: /** @var bool has output? */
41: public $replaced;
42:
43: /** @var MacroTokens */
44: public $tokenizer;
45:
46: /** @var MacroNode */
47: public $parentNode;
48:
49: /** @var string */
50: public $openingCode;
51:
52: /** @var string */
53: public $closingCode;
54:
55: /** @var string */
56: public $attrCode;
57:
58: /** @var string */
59: public $content;
60:
61: /** @var \stdClass user data */
62: public $data;
63:
64: /** @var HtmlNode closest HTML node */
65: public $htmlNode;
66:
67: /** @var string indicates n:attribute macro and type of prefix (PREFIX_INNER, PREFIX_TAG, PREFIX_NONE) */
68: public $prefix;
69:
70: public $saved;
71:
72:
73: public function __construct(IMacro $macro, $name, $args = NULL, $modifiers = NULL, self $parentNode = NULL, HtmlNode $htmlNode = NULL, $prefix = NULL)
74: {
75: $this->macro = $macro;
76: $this->name = (string) $name;
77: $this->modifiers = (string) $modifiers;
78: $this->parentNode = $parentNode;
79: $this->htmlNode = $htmlNode;
80: $this->prefix = $prefix;
81: $this->data = new \stdClass;
82: $this->setArgs($args);
83: }
84:
85:
86: public function setArgs($args)
87: {
88: $this->args = (string) $args;
89: $this->tokenizer = new MacroTokens($this->args);
90: }
91:
92: }
93: