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 pathObjectTemplate.php
156 lines (140 loc) · 5.17 KB
/
ObjectTemplate.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
<?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;
/**
* An ObjectTemplate is used to create objects at runtime.
*
* Properties added to an ObjectTemplate are added to each object
* created from the ObjectTemplate.
*/
class ObjectTemplate extends Template implements AdjustableExternalMemoryInterface
{
public function __construct(Isolate $isolate, FunctionTemplate $constructor = null)
{
parent::__construct($isolate);
}
/** Creates a new instance of this template.
*
* @param Context $context
*
* @return ObjectValue
*/
public function newInstance(Context $context): ObjectValue
{
}
/**
* Sets an accessor on the object template.
*
* Whenever the property with the given name is accessed on objects
* created from this ObjectTemplate the getter and setter callbacks
* are called instead of getting and setting the property directly
* on the JavaScript object.
*
* @param NameValue $name
* @param NameValue $name The name of the property for which an accessor is added.
*
* @param callable $getter The callback to invoke when getting the property.
* Callback signature should be (NameValue $property, PropertyCallbackInfo $info)
*
* @param callable $setter The callback to invoke when setting the property.
* Callback signature should be (NameValue $property, PropertyCallbackInfo $info)
*
* @param int $settings Access control settings for the accessor.
*
* @param int $attributes The attributes of the property for which an accessor is added.
*
* @param FunctionTemplate $receiver The signature describes valid receivers for the accessor
* and is used to perform implicit instance checks against them. If the
* receiver is incompatible (i.e. is not an instance of the constructor as
* defined by FunctionTemplate::HasInstance()), an implicit TypeError is
* thrown and no callback is invoked.
*/
public function setAccessor(
NameValue $name,
callable $getter,
callable $setter,
$settings = AccessControl::DEFAULT_ACCESS,
$attributes = PropertyAttribute::NONE,
FunctionTemplate $receiver
) {
}
/**
* Sets a named property handler on the object template.
*
* Whenever a property whose name is a string or a symbol is accessed on
* objects created from this object template, the provided callback is
* invoked instead of accessing the property directly on the JavaScript
* object.
*
* See NamedPropertyHandlerConfiguration constructor argument description for details
*
* @param NamedPropertyHandlerConfiguration The NamedPropertyHandlerConfiguration that defines the callbacks to invoke when accessing a property.
*/
public function setHandlerForNamedProperty(NamedPropertyHandlerConfiguration $configuration)
{
}
/**
* Sets an indexed property handler on the object template.
*
* Whenever an indexed property is accessed on objects created from
* this object template, the provided callback is invoked instead of
* accessing the property directly on the JavaScript object.
*
* See IndexedPropertyHandlerConfiguration constructor argument description for details
*
* @param IndexedPropertyHandlerConfiguration $configuration The IndexedPropertyHandlerConfiguration that defines the callbacks to invoke when accessing a property.
*/
public function setHandlerForIndexedProperty(IndexedPropertyHandlerConfiguration $configuration)
{
}
/**
* Sets the callback to be used when calling instances created from
* this template as a function. If no callback is set, instances
* behave like normal JavaScript objects that cannot be called as a
* function.
*
* @param callable $callback
*/
public function setCallAsFunctionHandler(callable $callback)
{
}
/**
* Returns true if the object will be an immutable prototype exotic object.
*
* @return bool
*/
public function isImmutableProto(): bool
{
}
/**
* Makes the ObjectTempate for an immutable prototype exotic object, with an
* immutable __proto__.
*
* @return bool
*/
public function setImmutableProto(): bool
{
}
/**
* {@inheritdoc}
*/
public function adjustExternalAllocatedMemory(int $change_in_bytes): int
{
}
/**
* {@inheritdoc}
*/
public function getExternalAllocatedMemory(): int
{
}
}