Skip to content

Commit 59b0117

Browse files
committed
Introduce common base class
1 parent 03059e6 commit 59b0117

20 files changed

+402
-373
lines changed

ext/dom/document.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ zend_result dom_document_config_read(dom_object *obj, zval *retval)
483483
/* {{{ URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-2141741547
484484
Since:
485485
*/
486-
PHP_METHOD(DOMDocument, createElement)
486+
PHP_METHOD(DOM_Document, createElement)
487487
{
488488
zval *id;
489489
xmlNode *node;
@@ -518,7 +518,7 @@ PHP_METHOD(DOMDocument, createElement)
518518
/* {{{ URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-35CB04B5
519519
Since:
520520
*/
521-
PHP_METHOD(DOMDocument, createDocumentFragment)
521+
PHP_METHOD(DOM_Document, createDocumentFragment)
522522
{
523523
zval *id;
524524
xmlNode *node;
@@ -546,7 +546,7 @@ PHP_METHOD(DOMDocument, createDocumentFragment)
546546
/* {{{ URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1975348127
547547
Since:
548548
*/
549-
PHP_METHOD(DOMDocument, createTextNode)
549+
PHP_METHOD(DOM_Document, createTextNode)
550550
{
551551
zval *id;
552552
xmlNode *node;
@@ -576,7 +576,7 @@ PHP_METHOD(DOMDocument, createTextNode)
576576
/* {{{ URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1334481328
577577
Since:
578578
*/
579-
PHP_METHOD(DOMDocument, createComment)
579+
PHP_METHOD(DOM_Document, createComment)
580580
{
581581
zval *id;
582582
xmlNode *node;
@@ -606,7 +606,7 @@ PHP_METHOD(DOMDocument, createComment)
606606
/* {{{ URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D26C0AF8
607607
Since:
608608
*/
609-
PHP_METHOD(DOMDocument, createCDATASection)
609+
PHP_METHOD(DOM_Document, createCDATASection)
610610
{
611611
zval *id;
612612
xmlNode *node;
@@ -636,7 +636,7 @@ PHP_METHOD(DOMDocument, createCDATASection)
636636
/* {{{ URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-135944439
637637
Since:
638638
*/
639-
PHP_METHOD(DOMDocument, createProcessingInstruction)
639+
PHP_METHOD(DOM_Document, createProcessingInstruction)
640640
{
641641
zval *id;
642642
xmlNode *node;
@@ -673,7 +673,7 @@ PHP_METHOD(DOMDocument, createProcessingInstruction)
673673
/* {{{ URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1084891198
674674
Since:
675675
*/
676-
PHP_METHOD(DOMDocument, createAttribute)
676+
PHP_METHOD(DOM_Document, createAttribute)
677677
{
678678
zval *id;
679679
xmlAttrPtr node;
@@ -744,7 +744,7 @@ PHP_METHOD(DOMDocument, createEntityReference)
744744
/* {{{ URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C9094
745745
Since:
746746
*/
747-
PHP_METHOD(DOMDocument, getElementsByTagName)
747+
PHP_METHOD(DOM_Document, getElementsByTagName)
748748
{
749749
size_t name_len;
750750
dom_object *intern, *namednode;
@@ -765,7 +765,7 @@ PHP_METHOD(DOMDocument, getElementsByTagName)
765765
/* {{{ URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Core-Document-importNode
766766
Since: DOM Level 2
767767
*/
768-
PHP_METHOD(DOMDocument, importNode)
768+
PHP_METHOD(DOM_Document, importNode)
769769
{
770770
zval *node;
771771
xmlDocPtr docp;
@@ -818,7 +818,7 @@ PHP_METHOD(DOMDocument, importNode)
818818
/* {{{ URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrElNS
819819
Since: DOM Level 2
820820
*/
821-
PHP_METHOD(DOMDocument, createElementNS)
821+
PHP_METHOD(DOM_Document, createElementNS)
822822
{
823823
zval *id;
824824
xmlDocPtr docp;
@@ -878,7 +878,7 @@ PHP_METHOD(DOMDocument, createElementNS)
878878
/* {{{ URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrAttrNS
879879
Since: DOM Level 2
880880
*/
881-
PHP_METHOD(DOMDocument, createAttributeNS)
881+
PHP_METHOD(DOM_Document, createAttributeNS)
882882
{
883883
zval *id;
884884
xmlDocPtr docp;
@@ -944,7 +944,7 @@ PHP_METHOD(DOMDocument, createAttributeNS)
944944
/* {{{ URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBTNNS
945945
Since: DOM Level 2
946946
*/
947-
PHP_METHOD(DOMDocument, getElementsByTagNameNS)
947+
PHP_METHOD(DOM_Document, getElementsByTagNameNS)
948948
{
949949
size_t uri_len, name_len;
950950
dom_object *intern, *namednode;
@@ -965,7 +965,7 @@ PHP_METHOD(DOMDocument, getElementsByTagNameNS)
965965
/* {{{ URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBId
966966
Since: DOM Level 2
967967
*/
968-
PHP_METHOD(DOMDocument, getElementById)
968+
PHP_METHOD(DOM_Document, getElementById)
969969
{
970970
zval *id;
971971
xmlDocPtr docp;
@@ -1042,7 +1042,7 @@ bool php_dom_adopt_node(xmlNodePtr nodep, dom_object *dom_object_new_document, x
10421042
Since: DOM Level 3
10431043
Modern spec URL: https://dom.spec.whatwg.org/#dom-document-adoptnode
10441044
*/
1045-
PHP_METHOD(DOMDocument, adoptNode)
1045+
PHP_METHOD(DOM_Document, adoptNode)
10461046
{
10471047
zval *node_zval;
10481048
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node_zval, dom_node_class_entry) == FAILURE) {
@@ -1079,7 +1079,7 @@ PHP_METHOD(DOMDocument, adoptNode)
10791079
/* {{{ URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-normalizeDocument
10801080
Since: DOM Level 3
10811081
*/
1082-
PHP_METHOD(DOMDocument, normalizeDocument)
1082+
PHP_METHOD(DOM_Document, normalizeDocument)
10831083
{
10841084
zval *id;
10851085
xmlDocPtr docp;
@@ -1753,14 +1753,14 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
17531753
/* }}} */
17541754

17551755
/* {{{ */
1756-
PHP_METHOD(DOMDocument, schemaValidate)
1756+
PHP_METHOD(DOM_Document, schemaValidate)
17571757
{
17581758
_dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE);
17591759
}
17601760
/* }}} end dom_document_schema_validate_file */
17611761

17621762
/* {{{ */
1763-
PHP_METHOD(DOMDocument, schemaValidateSource)
1763+
PHP_METHOD(DOM_Document, schemaValidateSource)
17641764
{
17651765
_dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING);
17661766
}
@@ -1849,14 +1849,14 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
18491849
/* }}} */
18501850

18511851
/* {{{ */
1852-
PHP_METHOD(DOMDocument, relaxNGValidate)
1852+
PHP_METHOD(DOM_Document, relaxNGValidate)
18531853
{
18541854
_dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE);
18551855
}
18561856
/* }}} end dom_document_relaxNG_validate_file */
18571857

18581858
/* {{{ */
1859-
PHP_METHOD(DOMDocument, relaxNGValidateSource)
1859+
PHP_METHOD(DOM_Document, relaxNGValidateSource)
18601860
{
18611861
_dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING);
18621862
}
@@ -2062,7 +2062,7 @@ PHP_METHOD(DOMDocument, saveHTML)
20622062
#endif /* defined(LIBXML_HTML_ENABLED) */
20632063

20642064
/* {{{ Register extended class used to create base node type */
2065-
PHP_METHOD(DOMDocument, registerNodeClass)
2065+
PHP_METHOD(DOM_Document, registerNodeClass)
20662066
{
20672067
zend_class_entry *basece = dom_node_class_entry, *ce = NULL;
20682068
dom_object *intern;
@@ -2084,7 +2084,7 @@ PHP_METHOD(DOMDocument, registerNodeClass)
20842084
/* {{{ URL: https://dom.spec.whatwg.org/#dom-parentnode-replacechildren
20852085
Since:
20862086
*/
2087-
PHP_METHOD(DOMDocument, replaceChildren)
2087+
PHP_METHOD(DOM_Document, replaceChildren)
20882088
{
20892089
uint32_t argc = 0;
20902090
zval *args;

ext/dom/dom_ce.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ extern PHP_DOM_EXPORT zend_class_entry *dom_notation_class_entry;
3737
extern PHP_DOM_EXPORT zend_class_entry *dom_entity_class_entry;
3838
extern PHP_DOM_EXPORT zend_class_entry *dom_entityreference_class_entry;
3939
extern PHP_DOM_EXPORT zend_class_entry *dom_processinginstruction_class_entry;
40+
extern PHP_DOM_EXPORT zend_class_entry *dom_abstract_base_document_class_entry;
4041
#ifdef LIBXML_XPATH_ENABLED
4142
extern PHP_DOM_EXPORT zend_class_entry *dom_xpath_class_entry;
4243
#endif

ext/dom/php_dom.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ PHP_DOM_EXPORT zend_class_entry *dom_notation_class_entry;
5656
PHP_DOM_EXPORT zend_class_entry *dom_entity_class_entry;
5757
PHP_DOM_EXPORT zend_class_entry *dom_entityreference_class_entry;
5858
PHP_DOM_EXPORT zend_class_entry *dom_processinginstruction_class_entry;
59+
PHP_DOM_EXPORT zend_class_entry *dom_abstract_base_document_class_entry;
5960
#ifdef LIBXML_XPATH_ENABLED
6061
PHP_DOM_EXPORT zend_class_entry *dom_xpath_class_entry;
6162
#endif
@@ -696,7 +697,10 @@ PHP_MINIT_FUNCTION(dom)
696697
zend_hash_merge(&dom_documentfragment_prop_handlers, &dom_node_prop_handlers, dom_copy_prop_handler, 0);
697698
zend_hash_add_ptr(&classes, dom_documentfragment_class_entry->name, &dom_documentfragment_prop_handlers);
698699

699-
dom_document_class_entry = register_class_DOMDocument(dom_node_class_entry, dom_parentnode_class_entry);
700+
dom_abstract_base_document_class_entry = register_class_DOM_Document(dom_node_class_entry, dom_parentnode_class_entry);
701+
// TODO: prop handlers
702+
703+
dom_document_class_entry = register_class_DOMDocument(dom_abstract_base_document_class_entry);
700704
dom_document_class_entry->create_object = dom_objects_new;
701705
zend_hash_init(&dom_document_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
702706
dom_register_prop_handler(&dom_document_prop_handlers, "doctype", sizeof("doctype")-1, dom_document_doctype_read, NULL);

0 commit comments

Comments
 (0)