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 pathphp_v8_null.cc
66 lines (51 loc) · 1.83 KB
/
php_v8_null.cc
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
/*
* This file is part of the pinepain/php-v8 PHP extension.
*
* Copyright (c) 2015-2018 Bogdan Padalko <pinepain@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
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php_v8_null.h"
#include "php_v8_primitive.h"
#include "php_v8_value.h"
#include "php_v8.h"
zend_class_entry *php_v8_null_class_entry;
#define this_ce php_v8_null_class_entry
static PHP_METHOD(NullValue, __construct) {
zval *php_v8_isolate_zv;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &php_v8_isolate_zv) == FAILURE) {
return;
}
PHP_V8_VALUE_CONSTRUCT(getThis(), php_v8_isolate_zv, php_v8_isolate, php_v8_value);
php_v8_value->persistent->Reset(isolate, v8::Null(isolate));
}
static PHP_METHOD(NullValue, value) {
if (zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_NULL()
}
PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1)
ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0)
ZEND_END_ARG_INFO()
// no strict typing as it returns NULL and null typehint doesn't work on PHP 7.1
ZEND_BEGIN_ARG_INFO_EX(arginfo_value, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
static const zend_function_entry php_v8_null_methods[] = {
PHP_V8_ME(NullValue, __construct, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
PHP_V8_ME(NullValue, value, ZEND_ACC_PUBLIC)
PHP_FE_END
};
PHP_MINIT_FUNCTION(php_v8_null) {
zend_class_entry ce;
INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "NullValue", php_v8_null_methods);
this_ce = zend_register_internal_class_ex(&ce, php_v8_primitive_class_entry);
return SUCCESS;
}