xref: /ext-ds/src/php/classes/php_collection_ce.c (revision b297e8f3)
1 #include "../../common.h"
2 #include "php_collection_ce.h"
3 
4 zend_class_entry *collection_ce;
5 
6 #define COLLECTION_ABSTRACT_ME(name) \
7     PHP_ABSTRACT_ME(Collection, name, arginfo_Collection_##name)
8 
php_ds_register_collection()9 void php_ds_register_collection()
10 {
11     zend_class_entry ce;
12 
13     zend_function_entry methods[] = {
14         COLLECTION_ABSTRACT_ME(clear)
15         COLLECTION_ABSTRACT_ME(copy)
16         COLLECTION_ABSTRACT_ME(isEmpty)
17         COLLECTION_ABSTRACT_ME(toArray)
18         PHP_FE_END
19     };
20 
21     INIT_CLASS_ENTRY(ce, PHP_DS_NS(Collection), methods);
22 
23     collection_ce = zend_register_internal_interface(&ce);
24 
25     zend_class_implements(collection_ce, 3,
26         zend_ce_aggregate,          // IteratorAggregate
27         spl_ce_Countable,           // Countable
28         php_json_serializable_ce    // Serializable
29     );
30 }
31