-
Notifications
You must be signed in to change notification settings - Fork 1
/
handlebars.stub.php
294 lines (250 loc) · 6.73 KB
/
handlebars.stub.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<?php
namespace Handlebars;
use ArrayAccess;
use IteratorAggregate;
use ArrayObject;
/**
* extension version
*/
const VERSION = "1.0.0";
/**
* libhandlebars version
*/
const LIBVERSION = "1.0.0";
/**
* libhandlebars version (at compile time)
*/
const LIBVERSION2 = "1.0.0";
/**
* If PSR extension is available
*/
const PSR = true;
/**
* The cache backend name
*/
const CACHE_BACKEND = 'mmap';
interface Exception {}
class CompileException extends \Exception implements Exception {}
class InvalidArgumentException extends \InvalidArgumentException implements Exception {}
class RuntimeException extends \RuntimeException implements Exception {}
class InvalidBinaryStringException extends \Exception implements Exception {}
class_alias(CompileException::class, "Handlebars\ParseException");
class Utils
{
/**
* Append context path for trackIds
*
* @param mixed $contextPath
* @param string $id
* @return string
*/
public static function appendContextPath($contextPath, string $id): string {}
/**
* @param mixed $value
* @return array
*/
public static function createFrame($value) {}
/**
* Prepare an expression for the output buffer. Handles certain
* javascript behaviours.
*
* @param mixed $value
* @return string
* @throws \Handlebars\RuntimeException
*/
public static function expression($value): string {}
/**
* Escape an expression for the output buffer. Does not handle certain
* javascript behaviours.
*
* @param mixed $value
* @return string
* @throws \Handlebars\RuntimeException
*/
public static function escapeExpression($value): string {}
/**
* Escape an expression for the output buffer. Handles certain
* javascript behaviours.
*
* @param mixed $value
* @retrun string
* @throws \Handlebars\RuntimeException
*/
public static function escapeExpressionCompat($value): string {}
/**
* Indent a multi-line string
*
* @param string $str
* @param string $indent
* @return string
*/
static public function indent(string $str, string $indent): string {}
/**
* Similar to is_callable(), but only allows closures and objects
* with an __invoke method, and removes the second and third
* arguments.
*
* @param array $array
* @return boolean
*/
public static function isCallable($arr): bool {}
/**
* Is the array a numeric array?
*
* @param array $array
* @return boolean
*/
public static function isIntArray(array $arr): bool {}
/**
* Looks up a field in an object or array without
* causing a notice
*
* @param mixed $objOrArray
* @param string $field
* @return mixed
*/
public static function nameLookup($objOrArray, string $field) {}
}
class SafeString
{
/**
* @var string
* This uses a typed property on >= PHP 7.4
*/
protected /*string*/ $value;
/**
* Constructor
*
* @param string $value
*/
public function __construct(string $value) {
$this->value = $value;
}
/**
* Magic toString method
*
* @return string
*/
public function __toString(): string {
return (string) $this->value;
}
}
interface Registry extends ArrayAccess, IteratorAggregate {}
class DefaultRegistry extends ArrayObject implements Registry {}
// ! These are not actually exposed by the extension, just a hack
if (class_exists('Psr\\Log\\LoggerAwareInterface')) {
interface LoggerAwareInterface extends Psr\Log\LoggerAwareInterface {}
} else {
interface LoggerAwareInterface {}
}
if (class_exists('Psr\\Log\\LoggerInterface')) {
interface LoggerInterface extends Psr\Log\LoggerInterface {}
} else {
interface LoggerInterface {}
}
/**
* This interface will not extend LoggerAwareInterface if the
* psr extension is not loaded.
*/
interface Impl extends LoggerAwareInterface
{
public function getHelpers(): ?Registry;
public function getPartials(): ?Registry;
public function getDecorators(): ?Registry;
public function getLogger(): ?LoggerInterface;
public function setHelpers(Registry $helpers): Impl;
public function setPartials(Registry $partials): Impl;
public function setDecorators(Registry $decorators): Impl;
public function setLogger(LoggerInterface $logger): Impl;
public function render(string $tmpl, $context = null, array $options = null): string;
public function renderFile(string $filename, $context = null, array $options = null): string;
}
abstract class BaseImpl implements Impl
{
/**
* @var Registry
*/
protected $helpers;
/**
* @var Registry
*/
protected $partials;
/**
* @var Registry
*/
protected $decorators;
/**
* @var LoggerInterface
*/
protected $logger;
/**
* @return Registry
*/
public function getDecorators(): ?Registry {
return $this->decorators;
}
/**
* @return Registry
*/
public function getHelpers(): ?Registry {
return $this->helpers;
}
/**
* @return Registry
*/
public function getPartials(): ?Registry {
return $this->partials;
}
/**
* @return LoggerInterface
*/
public function getLogger(): ?LoggerInterface {
return $this->logger;
}
/**
* @param Registry $helpers
*/
public function setHelpers(Registry $helpers): Impl {
$this->helpers = $helpers;
return $this;
}
/**
* @param Registry $partials
*/
public function setPartials(Registry $partials): Impl {
$this->partials = $partials;
return $this;
}
/**
* @param Registry $decorators
*/
public function setDecorators(Registry $decorators): Impl {
$this->decorators = $decorators;
return $this;
}
/**
* @param LoggerInterface $logger
*/
public function setLogger(LoggerInterface $logger): Impl {
$this->logger = $logger;
return $this;
}
}
class VM extends BaseImpl
{
public function setHelpers(Registry $helpers): Impl {}
public function setPartials(Registry $partials): Impl {}
public function setLogger(LoggerInterface $partials): Impl {}
public function render(string $tmpl, $context = null, array $options = null): string {}
public function renderFile(string $filename, $context = null, array $options = null): string {}
public function compile(string $tmpl, array $options = null): string {}
public function renderFromBinaryString(string $binaryString, $context = null, array $options = null): string {}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: fdm=marker
* vim: et sw=4 ts=4
*/