@@ -30,7 +30,7 @@ zend_class_entry* php_phongo_binary_ce;
30
30
31
31
/* Initialize the object and return whether it was successful. An exception will
32
32
* be thrown on error. */
33
- static bool php_phongo_binary_init (php_phongo_binary_t * intern , const char * data , size_t data_len , zend_long type ) /* {{{ */
33
+ static bool php_phongo_binary_init (php_phongo_binary_t * intern , const char * data , size_t data_len , zend_long type )
34
34
{
35
35
if (type < 0 || type > UINT8_MAX ) {
36
36
phongo_throw_exception (PHONGO_ERROR_INVALID_ARGUMENT , "Expected type to be an unsigned 8-bit integer, %" PHONGO_LONG_FORMAT " given" , type );
@@ -47,11 +47,11 @@ static bool php_phongo_binary_init(php_phongo_binary_t* intern, const char* data
47
47
intern -> type = (uint8_t ) type ;
48
48
49
49
return true;
50
- } /* }}} */
50
+ }
51
51
52
52
/* Initialize the object from a HashTable and return whether it was successful.
53
53
* An exception will be thrown on error. */
54
- static bool php_phongo_binary_init_from_hash (php_phongo_binary_t * intern , HashTable * props ) /* {{{ */
54
+ static bool php_phongo_binary_init_from_hash (php_phongo_binary_t * intern , HashTable * props )
55
55
{
56
56
zval * data , * type ;
57
57
@@ -63,9 +63,9 @@ static bool php_phongo_binary_init_from_hash(php_phongo_binary_t* intern, HashTa
63
63
64
64
phongo_throw_exception (PHONGO_ERROR_INVALID_ARGUMENT , "%s initialization requires \"data\" string and \"type\" integer fields" , ZSTR_VAL (php_phongo_binary_ce -> name ));
65
65
return false;
66
- } /* }}} */
66
+ }
67
67
68
- static HashTable * php_phongo_binary_get_properties_hash (phongo_compat_object_handler_type * object , bool is_temp ) /* {{{ */
68
+ static HashTable * php_phongo_binary_get_properties_hash (phongo_compat_object_handler_type * object , bool is_temp )
69
69
{
70
70
php_phongo_binary_t * intern ;
71
71
HashTable * props ;
@@ -89,10 +89,9 @@ static HashTable* php_phongo_binary_get_properties_hash(phongo_compat_object_han
89
89
}
90
90
91
91
return props ;
92
- } /* }}} */
92
+ }
93
93
94
- /* {{{ proto void MongoDB\BSON\Binary::__construct(string $data, int $type)
95
- Construct a new BSON binary type */
94
+ /* Construct a new BSON binary type */
96
95
static PHP_METHOD (MongoDB_BSON_Binary , __construct )
97
96
{
98
97
php_phongo_binary_t * intern ;
@@ -108,10 +107,8 @@ static PHP_METHOD(MongoDB_BSON_Binary, __construct)
108
107
PHONGO_PARSE_PARAMETERS_END ();
109
108
110
109
php_phongo_binary_init (intern , data , data_len , type );
111
- } /* }}} */
110
+ }
112
111
113
- /* {{{ proto MongoDB\BSON\Binary MongoDB\BSON\Binary::__set_state(array $properties)
114
- */
115
112
static PHP_METHOD (MongoDB_BSON_Binary , __set_state )
116
113
{
117
114
php_phongo_binary_t * intern ;
@@ -128,10 +125,9 @@ static PHP_METHOD(MongoDB_BSON_Binary, __set_state)
128
125
props = Z_ARRVAL_P (array );
129
126
130
127
php_phongo_binary_init_from_hash (intern , props );
131
- } /* }}} */
128
+ }
132
129
133
- /* {{{ proto string MongoDB\BSON\Binary::__toString()
134
- Return the Binary's data string. */
130
+ /* Return the Binary's data string. */
135
131
static PHP_METHOD (MongoDB_BSON_Binary , __toString )
136
132
{
137
133
php_phongo_binary_t * intern ;
@@ -141,10 +137,8 @@ static PHP_METHOD(MongoDB_BSON_Binary, __toString)
141
137
intern = Z_BINARY_OBJ_P (getThis ());
142
138
143
139
RETURN_STRINGL (intern -> data , intern -> data_len );
144
- } /* }}} */
140
+ }
145
141
146
- /* {{{ proto string MongoDB\BSON\Binary::getData()
147
- */
148
142
static PHP_METHOD (MongoDB_BSON_Binary , getData )
149
143
{
150
144
php_phongo_binary_t * intern ;
@@ -154,10 +148,8 @@ static PHP_METHOD(MongoDB_BSON_Binary, getData)
154
148
PHONGO_PARSE_PARAMETERS_NONE ();
155
149
156
150
RETURN_STRINGL (intern -> data , intern -> data_len );
157
- } /* }}} */
151
+ }
158
152
159
- /* {{{ proto integer MongoDB\BSON\Binary::getType()
160
- */
161
153
static PHP_METHOD (MongoDB_BSON_Binary , getType )
162
154
{
163
155
php_phongo_binary_t * intern ;
@@ -167,10 +159,8 @@ static PHP_METHOD(MongoDB_BSON_Binary, getType)
167
159
PHONGO_PARSE_PARAMETERS_NONE ();
168
160
169
161
RETURN_LONG (intern -> type );
170
- } /* }}} */
162
+ }
171
163
172
- /* {{{ proto array MongoDB\BSON\Binary::jsonSerialize()
173
- */
174
164
static PHP_METHOD (MongoDB_BSON_Binary , jsonSerialize )
175
165
{
176
166
php_phongo_binary_t * intern ;
@@ -191,10 +181,8 @@ static PHP_METHOD(MongoDB_BSON_Binary, jsonSerialize)
191
181
192
182
type_len = snprintf (type , sizeof (type ), "%02x" , intern -> type );
193
183
ADD_ASSOC_STRINGL (return_value , "$type" , type , type_len );
194
- } /* }}} */
184
+ }
195
185
196
- /* {{{ proto string MongoDB\BSON\Binary::serialize()
197
- */
198
186
static PHP_METHOD (MongoDB_BSON_Binary , serialize )
199
187
{
200
188
php_phongo_binary_t * intern ;
@@ -219,10 +207,8 @@ static PHP_METHOD(MongoDB_BSON_Binary, serialize)
219
207
220
208
smart_str_free (& buf );
221
209
zval_ptr_dtor (& retval );
222
- } /* }}} */
210
+ }
223
211
224
- /* {{{ proto void MongoDB\BSON\Binary::unserialize(string $serialized)
225
- */
226
212
static PHP_METHOD (MongoDB_BSON_Binary , unserialize )
227
213
{
228
214
php_phongo_binary_t * intern ;
@@ -249,19 +235,15 @@ static PHP_METHOD(MongoDB_BSON_Binary, unserialize)
249
235
250
236
php_phongo_binary_init_from_hash (intern , HASH_OF (& props ));
251
237
zval_ptr_dtor (& props );
252
- } /* }}} */
238
+ }
253
239
254
- /* {{{ proto array MongoDB\Driver\Binary::__serialize()
255
- */
256
240
static PHP_METHOD (MongoDB_BSON_Binary , __serialize )
257
241
{
258
242
PHONGO_PARSE_PARAMETERS_NONE ();
259
243
260
244
RETURN_ARR (php_phongo_binary_get_properties_hash (PHONGO_COMPAT_OBJ_P (getThis ()), true));
261
- } /* }}} */
245
+ }
262
246
263
- /* {{{ proto void MongoDB\Driver\Binary::__unserialize(array $data)
264
- */
265
247
static PHP_METHOD (MongoDB_BSON_Binary , __unserialize )
266
248
{
267
249
zval * data ;
@@ -271,12 +253,12 @@ static PHP_METHOD(MongoDB_BSON_Binary, __unserialize)
271
253
PHONGO_PARSE_PARAMETERS_END ();
272
254
273
255
php_phongo_binary_init_from_hash (Z_BINARY_OBJ_P (getThis ()), Z_ARRVAL_P (data ));
274
- } /* }}} */
256
+ }
275
257
276
- /* {{{ MongoDB\BSON\Binary object handlers */
258
+ /* MongoDB\BSON\Binary object handlers */
277
259
static zend_object_handlers php_phongo_handler_binary ;
278
260
279
- static void php_phongo_binary_free_object (zend_object * object ) /* {{{ */
261
+ static void php_phongo_binary_free_object (zend_object * object )
280
262
{
281
263
php_phongo_binary_t * intern = Z_OBJ_BINARY (object );
282
264
@@ -290,9 +272,9 @@ static void php_phongo_binary_free_object(zend_object* object) /* {{{ */
290
272
zend_hash_destroy (intern -> properties );
291
273
FREE_HASHTABLE (intern -> properties );
292
274
}
293
- } /* }}} */
275
+ }
294
276
295
- static zend_object * php_phongo_binary_create_object (zend_class_entry * class_type ) /* {{{ */
277
+ static zend_object * php_phongo_binary_create_object (zend_class_entry * class_type )
296
278
{
297
279
php_phongo_binary_t * intern = zend_object_alloc (sizeof (php_phongo_binary_t ), class_type );
298
280
@@ -302,9 +284,9 @@ static zend_object* php_phongo_binary_create_object(zend_class_entry* class_type
302
284
intern -> std .handlers = & php_phongo_handler_binary ;
303
285
304
286
return & intern -> std ;
305
- } /* }}} */
287
+ }
306
288
307
- static zend_object * php_phongo_binary_clone_object (phongo_compat_object_handler_type * object ) /* {{{ */
289
+ static zend_object * php_phongo_binary_clone_object (phongo_compat_object_handler_type * object )
308
290
{
309
291
php_phongo_binary_t * intern ;
310
292
php_phongo_binary_t * new_intern ;
@@ -319,9 +301,9 @@ static zend_object* php_phongo_binary_clone_object(phongo_compat_object_handler_
319
301
php_phongo_binary_init (new_intern , intern -> data , intern -> data_len , intern -> type );
320
302
321
303
return new_object ;
322
- } /* }}} */
304
+ }
323
305
324
- static int php_phongo_binary_compare_objects (zval * o1 , zval * o2 ) /* {{{ */
306
+ static int php_phongo_binary_compare_objects (zval * o1 , zval * o2 )
325
307
{
326
308
php_phongo_binary_t * intern1 , * intern2 ;
327
309
@@ -341,21 +323,20 @@ static int php_phongo_binary_compare_objects(zval* o1, zval* o2) /* {{{ */
341
323
}
342
324
343
325
return zend_binary_strcmp (intern1 -> data , intern1 -> data_len , intern2 -> data , intern2 -> data_len );
344
- } /* }}} */
326
+ }
345
327
346
- static HashTable * php_phongo_binary_get_debug_info (phongo_compat_object_handler_type * object , int * is_temp ) /* {{{ */
328
+ static HashTable * php_phongo_binary_get_debug_info (phongo_compat_object_handler_type * object , int * is_temp )
347
329
{
348
330
* is_temp = 1 ;
349
331
return php_phongo_binary_get_properties_hash (object , true);
350
- } /* }}} */
332
+ }
351
333
352
- static HashTable * php_phongo_binary_get_properties (phongo_compat_object_handler_type * object ) /* {{{ */
334
+ static HashTable * php_phongo_binary_get_properties (phongo_compat_object_handler_type * object )
353
335
{
354
336
return php_phongo_binary_get_properties_hash (object , false);
355
- } /* }}} */
356
- /* }}} */
337
+ }
357
338
358
- void php_phongo_binary_init_ce (INIT_FUNC_ARGS ) /* {{{ */
339
+ void php_phongo_binary_init_ce (INIT_FUNC_ARGS )
359
340
{
360
341
php_phongo_binary_ce = register_class_MongoDB_BSON_Binary (php_phongo_binary_interface_ce , php_phongo_json_serializable_ce , php_phongo_type_ce , zend_ce_serializable );
361
342
php_phongo_binary_ce -> create_object = php_phongo_binary_create_object ;
@@ -371,4 +352,4 @@ void php_phongo_binary_init_ce(INIT_FUNC_ARGS) /* {{{ */
371
352
php_phongo_handler_binary .get_properties = php_phongo_binary_get_properties ;
372
353
php_phongo_handler_binary .free_obj = php_phongo_binary_free_object ;
373
354
php_phongo_handler_binary .offset = XtOffsetOf (php_phongo_binary_t , std );
374
- } /* }}} */
355
+ }
0 commit comments