This repository was archived by the owner on Mar 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathObjectValue.php
534 lines (486 loc) · 13.3 KB
/
ObjectValue.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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
<?php declare(strict_types=1);
/**
* This file is part of the phpv8/php-v8 PHP extension.
*
* Copyright (c) 2015-2018 Bogdan Padalko <thepinepain@gmail.com>
*
* Licensed under the MIT license: http://opensource.org/licenses/MIT
*
* For the full copyright and license information, please view the
* LICENSE file that was distributed with this source or visit
* http://opensource.org/licenses/MIT
*/
namespace V8;
/**
* A JavaScript object (ECMA-262, 4.3.3)
*/
class ObjectValue extends Value implements AdjustableExternalMemoryInterface
{
public function __construct(Context $context)
{
parent::__construct($context->getIsolate());
}
/**
* @return Context
*/
public function getContext()
{
}
/**
* @param Context $context
* @param Value $key
* @param Value $value
*
* @return bool
*/
public function set(Context $context, Value $key, Value $value): bool
{
}
/**
* Implements CreateDataProperty (ECMA-262, 7.3.4).
*
* Defines a configurable, writable, enumerable property with the given value
* on the object unless the property already exists and is not configurable
* or the object is not extensible.
*
* @param Context $context
* @param NameValue $key
* @param Value $value
*
* @return bool
*/
public function createDataProperty(Context $context, NameValue $key, Value $value): bool
{
}
/**
* Implements DefineOwnProperty.
*
* In general, CreateDataProperty will be faster, however, does not allow for specifying attributes.
*
* @param Context $context
* @param NameValue $key
* @param Value $value
* @param int $attributes
*
* @return bool
*/
public function defineOwnProperty(
Context $context,
NameValue $key,
Value $value,
int $attributes = PropertyAttribute::NONE
): bool {
}
/**
* @param Context $context
* @param Value $key
*
* @return Value|PrimitiveValue|ObjectValue
*/
public function get(Context $context, Value $key): Value
{
}
/**
* Gets the property attributes of a property which can be None or
* any combination of ReadOnly, DontEnum and DontDelete. Returns
* None when the property doesn't exist.
*
* @param Context $context
* @param NameValue $key
*
* @return int
*/
public function getPropertyAttributes(Context $context, NameValue $key): int
{
}
/**
* Returns Object.getOwnPropertyDescriptor as per ES5 section 15.2.3.3.
*
* @param Context $context
* @param NameValue $key
*
* @return Value|PrimitiveValue|ObjectValue
*/
public function getOwnPropertyDescriptor(Context $context, NameValue $key): Value
{
}
/**
* @param Context $context
* @param Value $key
*
* @return bool
*/
public function has(Context $context, Value $key): bool
{
}
/**
* @param Context $context
* @param Value $key
*
* @return bool
*/
public function delete(Context $context, Value $key): bool
{
}
/**
* @param Context $context
* @param NameValue $name
* @param callable $getter
* @param callable $setter
* @param int $settings
* @param int $attributes
*
* @return bool
*/
public function setAccessor(
Context $context,
NameValue $name,
callable $getter,
callable $setter = null,
int $settings = AccessControl::DEFAULT_ACCESS,
int $attributes = PropertyAttribute::NONE
): bool {
}
/**
* @param NameValue $name
* @param FunctionObject $getter
* @param FunctionObject|null $setter
* @param int $attributes
* @param int $settings
*/
public function setAccessorProperty(
NameValue $name,
FunctionObject $getter,
FunctionObject $setter = null,
int $attributes = PropertyAttribute::NONE,
int $settings = AccessControl::DEFAULT_ACCESS
) {
}
/**
* Sets a native data property like Template::SetNativeDataProperty, but
* this method sets on this object directly.
*
* @param Context $context
* @param NameValue $name
* @param callable $getter
* @param callable $setter
* @param int $attributes
*
* @return bool
*/
public function setNativeDataProperty(
Context $context,
NameValue $name,
callable $getter,
callable $setter = null,
int $attributes = PropertyAttribute::NONE
): bool {
}
/**
* Attempts to create a property with the given name which behaves like a data
* property, except that the provided getter is invoked (and provided with the
* data value) to supply its value the first time it is read. After the
* property is accessed once, it is replaced with an ordinary data property.
*
* Analogous to Template::SetLazyDataProperty.
*
* @param Context $context
* @param NameValue $name
* @param callable $getter
* @param int $attributes
*
* @return bool
*/
public function setLazyDataProperty(
Context $context,
NameValue $name,
callable $getter,
callable $setter = null,
int $attributes = PropertyAttribute::NONE
): bool {
}
/**
* Returns an array containing the names of the enumerable properties
* of this object, including properties from prototype objects. The
* array returned by this method contains the same values as would
* be enumerated by a for-in statement over this object.
*
* @param Context $context
* @param int $mode One of KeyCollectionMode options
* @param int $property_filter One or multiple PropertyFilter options
* @param int $index_filter One or multiple IndexFilter options
* @param bool $convert_to_strings Convert integer indices to strings
*
* @return ArrayObject
*/
public function getPropertyNames(
Context $context,
int $mode = KeyCollectionMode::kOwnOnly,
int $property_filter = PropertyFilter::ALL_PROPERTIES,
int $index_filter = IndexFilter::kIncludeIndices,
bool $convert_to_strings = false
): ArrayObject {
}
/**
* This function has the same functionality as GetPropertyNames but
* the returned array doesn't contain the names of properties from
* prototype objects.
*
* @param Context $context
* @param int $filter One or multiple PropertyFilter options
* @param bool $convert_to_strings Will convert integer indices to strings
*
* @return ArrayObject
*/
public function getOwnPropertyNames(
Context $context,
int $filter = PropertyFilter::ALL_PROPERTIES,
bool $convert_to_strings = false
): ArrayObject {
}
/**
* Get the prototype object. This does not skip objects marked to
* be skipped by __proto__ and it does not consult the security
* handler.
*
* @return Value
*/
public function getPrototype(): Value
{
}
/**
* Set the prototype object. This does not skip objects marked to
* be skipped by __proto__ and it does not consult the security
* handler.
*
* @param Context $context
* @param Value $prototype
*
* @return bool
*/
public function setPrototype(Context $context, Value $prototype): bool
{
}
/**
* Finds an instance of the given function template in the prototype
* chain.
*
* @param FunctionTemplate $tmpl
*
* @return Object
*/
public function findInstanceInPrototypeChain(FunctionTemplate $tmpl): Object
{
}
/**
* Call builtin Object.prototype.toString on this object.
* This is different from Value::ToString() that may call
* user-defined toString function. This one does not.
*
* @param Context $context
*
* @return StringValue
*/
public function objectProtoToString(Context $context): StringValue
{
}
/**
* Returns the name of the function invoked as a constructor for this object.
*
* @return StringValue
*/
public function getConstructorName(): StringValue
{
}
/**
* Sets the integrity level of the object.
*
* @param Context $context
* @param int $level One of IntegrityLevel::{kFrozen, kSealed}
*
* @return bool
*/
public function setIntegrityLevel(Context $context, int $level): bool
{
}
/**
* @param Context $context
* @param NameValue $key
*
* @return bool
*/
public function hasOwnProperty(Context $context, NameValue $key): bool
{
}
/**
* @param Context $context
*
* @param NameValue $key
*
* @return bool
*/
public function hasRealNamedProperty(Context $context, NameValue $key): bool
{
}
/**
* @param Context $context
* @param int $index
*
* @return bool
*/
public function hasRealIndexedProperty(Context $context, int $index): bool
{
}
/**
* @param Context $context
* @param NameValue $key
*
* @return bool
*/
public function hasRealNamedCallbackProperty(Context $context, NameValue $key): bool
{
}
/**
* If result.IsEmpty() no real property was located in the prototype chain.
* This means interceptors in the prototype chain are not called.
*
* @param Context $context
* @param NameValue $key
*
* @return Value
*/
public function getRealNamedPropertyInPrototypeChain(Context $context, NameValue $key): Value
{
}
/**
* Gets the property attributes of a real property in the prototype chain,
* which can be None or any combination of ReadOnly, DontEnum and DontDelete.
* Interceptors in the prototype chain are not called.
*
* @param Context $context
* @param NameValue $key
*
* @return int
*/
public function getRealNamedPropertyAttributesInPrototypeChain(Context $context, NameValue $key): int
{
}
/**
* If result.IsEmpty() no real property was located on the object or
* in the prototype chain.
* This means interceptors in the prototype chain are not called.
*
* @param Context $context
* @param NameValue $key
*
* @return Value
*/
public function getRealNamedProperty(Context $context, NameValue $key): Value
{
}
/**
* Gets the property attributes of a real property which can be
* None or any combination of ReadOnly, DontEnum and DontDelete.
* Interceptors in the prototype chain are not called.
*
* @param Context $context
* @param NameValue $key
*
* @return int
*/
public function getRealNamedPropertyAttributes(Context $context, NameValue $key): int
{
}
/**
* Tests for a named lookup interceptor.
*
* @return bool
*/
public function hasNamedLookupInterceptor(): bool
{
}
/** Tests for an index lookup interceptor.
*
* @return bool
*/
public function hasIndexedLookupInterceptor(): bool
{
}
/**
* Returns the identity hash for this object. The current implementation
* uses a hidden property on the object to store the identity hash.
*
* The return value will never be 0. Also, it is not guaranteed to be
* unique.
*
* @return int
*/
public function getIdentityHash(): int
{
}
/**
* Clone this object with a fast but shallow copy. Values will point
* to the same values as the original object.
*
* @return ObjectValue
*/
public function clone(): ObjectValue
{
}
/**
* Checks whether a callback is set by the
* ObjectTemplate::SetCallAsFunctionHandler method.
* When an Object is callable this method returns true.
*
* @return bool
*/
public function isCallable(): bool
{
}
/**
* True if this object is a constructor.
*
* @return bool
*/
public function isConstructor(): bool
{
}
/**
* Call an Object as a function if a callback is set by the
* ObjectTemplate::SetCallAsFunctionHandler method.
*
* @param Context $context
* @param Value $recv
* @param array $arguments
*
* @return Value|PrimitiveValue|ObjectValue
*/
public function callAsFunction(Context $context, Value $recv, array $arguments = []): Value
{
}
/**
* Call an Object as a constructor if a callback is set by the
* ObjectTemplate::SetCallAsFunctionHandler method.
* Note: This method behaves like the Function::NewInstance method.
*
* @param Context $context
* @param array $arguments
*
* @return Value|PrimitiveValue|ObjectValue
*/
public function callAsConstructor(Context $context, array $arguments = []): Value
{
}
/**
* {@inheritdoc}
*/
public function adjustExternalAllocatedMemory(int $change_in_bytes): int
{
}
/**
* {@inheritdoc}
*/
public function getExternalAllocatedMemory(): int
{
}
}