-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphp_throwable_type.v
More file actions
147 lines (117 loc) · 3.39 KB
/
Copy pathphp_throwable_type.v
File metadata and controls
147 lines (117 loc) · 3.39 KB
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
module vphp
pub struct PhpThrowable {
mut:
object PhpObject
}
pub fn PhpThrowable.from_zval(z ZVal) ?PhpThrowable {
if !z.is_object() || !z.is_instance_of('Throwable') {
return none
}
return PhpThrowable{
object: PhpObject.must_from_zval(z) or { return none }
}
}
pub fn PhpThrowable.must_from_zval(z ZVal) !PhpThrowable {
t := PhpThrowable.from_zval(z) or { return error('zval is not Throwable') }
return t
}
pub fn PhpThrowable.from_persistent_owned_zbox(value PersistentOwnedZBox) ?PhpThrowable {
if !value.is_object() || !value.to_zval().is_instance_of('Throwable') {
return none
}
object := PhpObject.from_persistent_owned_zbox(value) or { return none }
return PhpThrowable{
object: object
}
}
pub fn PhpThrowable.from_persistent_zval(z ZVal) ?PhpThrowable {
return PhpThrowable.from_persistent_owned_zbox(PersistentOwnedZBox.from_persistent_zval(z))
}
pub fn PhpThrowable.from_request_owned_zbox(value RequestOwnedZBox) ?PhpThrowable {
object := PhpObject.from_request_owned_zbox(value) or { return none }
if !object.to_zval().is_instance_of('Throwable') {
return none
}
return PhpThrowable{
object: object
}
}
pub fn (t PhpThrowable) to_zval() ZVal {
return t.object.to_zval()
}
pub fn (t PhpThrowable) to_object() PhpObject {
return t.object
}
pub fn (t PhpThrowable) to_borrowed() PhpThrowable {
return PhpThrowable{
object: t.object.to_borrowed()
}
}
pub fn (t PhpThrowable) borrowed() PhpThrowable {
return t.to_borrowed()
}
pub fn (t PhpThrowable) borrow() PhpThrowable {
return t.to_borrowed()
}
pub fn (t PhpThrowable) to_borrowed_zbox() RequestBorrowedZBox {
return t.object.to_borrowed_zbox()
}
pub fn (t PhpThrowable) to_request_owned() PhpThrowable {
return PhpThrowable.from_request_owned_zbox(t.object.to_request_owned_zbox()) or {
t.to_borrowed()
}
}
pub fn (t PhpThrowable) owned() PhpThrowable {
return t.to_request_owned()
}
pub fn (t PhpThrowable) to_request_owned_zbox() RequestOwnedZBox {
return t.object.to_request_owned_zbox()
}
pub fn (t PhpThrowable) to_persistent_owned() PhpThrowable {
return PhpThrowable.from_persistent_owned_zbox(t.object.to_persistent_owned_zbox()) or {
t.to_borrowed()
}
}
pub fn (t PhpThrowable) retain() PhpThrowable {
return t.to_persistent_owned()
}
pub fn (t PhpThrowable) retained() PhpThrowable {
return t.to_persistent_owned()
}
pub fn (t PhpThrowable) to_persistent_owned_zbox() PersistentOwnedZBox {
return t.object.to_persistent_owned_zbox()
}
pub fn (t PhpThrowable) is_borrowed() bool {
return t.object.is_borrowed()
}
pub fn (t PhpThrowable) is_owned() bool {
return t.object.is_owned()
}
pub fn (t PhpThrowable) is_retained() bool {
return t.object.is_retained()
}
pub fn (mut t PhpThrowable) release() {
t.object.release()
}
pub fn (t PhpThrowable) class_name() string {
return t.object.class_name()
}
pub fn (t PhpThrowable) message() string {
return t.object.method_v[string]('getMessage', []) or { '' }
}
pub fn (t PhpThrowable) code() int {
return t.object.method_v[int]('getCode', []) or { 0 }
}
pub fn (t PhpThrowable) file() string {
return t.object.method_v[string]('getFile', []) or { '' }
}
pub fn (t PhpThrowable) line() int {
return t.object.method_v[int]('getLine', []) or { 0 }
}
pub fn (t PhpThrowable) trace_as_string() string {
return t.object.method_v[string]('getTraceAsString', []) or { '' }
}
pub fn (t PhpThrowable) throw() {
mut z := t.to_zval().dup()
throw_exception_object(mut z)
}