diff options
Diffstat (limited to 'vendor/thecodingmachine/safe/generated/xml.php')
-rw-r--r-- | vendor/thecodingmachine/safe/generated/xml.php | 711 |
1 files changed, 666 insertions, 45 deletions
diff --git a/vendor/thecodingmachine/safe/generated/xml.php b/vendor/thecodingmachine/safe/generated/xml.php index 4f9f6606c..6f2679dd6 100644 --- a/vendor/thecodingmachine/safe/generated/xml.php +++ b/vendor/thecodingmachine/safe/generated/xml.php @@ -5,72 +5,449 @@ namespace Safe; use Safe\Exceptions\XmlException; /** - * xml_parser_create_ns creates a new XML parser - * with XML namespace support and returns a resource handle referencing - * it to be used by the other XML functions. - * - * @param string $encoding The input encoding is automatically detected, so that the - * encoding parameter specifies only the output - * encoding. In PHP 5.0.0 and 5.0.1, the default output charset is - * ISO-8859-1, while in PHP 5.0.2 and upper is UTF-8. The supported - * encodings are ISO-8859-1, UTF-8 and - * US-ASCII. - * @param string $separator With a namespace aware parser tag parameters passed to the various - * handler functions will consist of namespace and tag name separated by - * the string specified in separator. - * @return resource Returns a resource handle for the new XML parser. + * Frees the given XML parser. + * + * @param resource $parser * @throws XmlException * */ -function xml_parser_create_ns(string $encoding = null, string $separator = ":") +function xml_parser_free($parser): void { error_clear_last(); - if ($separator !== ":") { - $result = \xml_parser_create_ns($encoding, $separator); - } elseif ($encoding !== null) { - $result = \xml_parser_create_ns($encoding); - } else { - $result = \xml_parser_create_ns(); + $result = \xml_parser_free($parser); + if ($result === false) { + throw XmlException::createFromPhpError(); } +} + + +/** + * Sets the character data handler function for the XML parser + * parser. + * + * @param resource $parser A reference to the XML parser to set up character data handler function. + * @param callable $handler handler is a string containing the name of a + * function that must exist when xml_parse is called + * for parser. + * + * The function named by handler must accept + * two parameters: + * + * handler + * XMLParserparser + * stringdata + * + * + * + * parser + * + * + * The first parameter, parser, is a + * reference to the XML parser calling the handler. + * + * + * + * + * data + * + * + * The second parameter, data, contains + * the character data as a string. + * + * + * + * + * + * Character data handler is called for every piece of a text in the XML + * document. It can be called multiple times inside each fragment (e.g. + * for non-ASCII strings). + * + * If a handler function is set to an empty string, or FALSE, the handler + * in question is disabled. + * @throws XmlException + * + */ +function xml_set_character_data_handler($parser, callable $handler): void +{ + error_clear_last(); + $result = \xml_set_character_data_handler($parser, $handler); if ($result === false) { throw XmlException::createFromPhpError(); } - return $result; } /** - * xml_parser_create creates a new XML parser - * and returns a resource handle referencing it to be used by the - * other XML functions. - * - * @param string $encoding The optional encoding specifies the character - * encoding for the input/output in PHP 4. Starting from PHP 5, the input - * encoding is automatically detected, so that the - * encoding parameter specifies only the output - * encoding. In PHP 4, the default output encoding is the same as the - * input charset. If empty string is passed, the parser attempts to identify - * which encoding the document is encoded in by looking at the heading 3 or - * 4 bytes. In PHP 5.0.0 and 5.0.1, the default output charset is - * ISO-8859-1, while in PHP 5.0.2 and upper is UTF-8. The supported - * encodings are ISO-8859-1, UTF-8 and - * US-ASCII. - * @return resource Returns a resource handle for the new XML parser. + * Sets the default handler function for the XML parser + * parser. + * + * @param resource $parser A reference to the XML parser to set up default handler function. + * @param callable $handler handler is a string containing the name of a + * function that must exist when xml_parse is called + * for parser. + * + * The function named by handler must accept + * two parameters: + * + * handler + * XMLParserparser + * stringdata + * + * + * + * + * parser + * + * + * + * The first parameter, parser, is a + * reference to the XML parser calling the handler. + * + * + * + * + * + * data + * + * + * + * The second parameter, data, contains + * the character data.This may be the XML declaration, + * document type declaration, entities or other data for which + * no other handler exists. + * + * + * + * + * + * If a handler function is set to an empty string, or FALSE, the handler + * in question is disabled. * @throws XmlException * */ -function xml_parser_create(string $encoding = null) +function xml_set_default_handler($parser, callable $handler): void { error_clear_last(); - if ($encoding !== null) { - $result = \xml_parser_create($encoding); - } else { - $result = \xml_parser_create(); + $result = \xml_set_default_handler($parser, $handler); + if ($result === false) { + throw XmlException::createFromPhpError(); } +} + + +/** + * Sets the element handler functions for the XML parser. + * start_handler and + * end_handler are strings containing + * the names of functions that must exist when xml_parse + * is called for parser. + * + * @param resource $parser A reference to the XML parser to set up start and end element handler functions. + * @param callable $start_handler The function named by start_handler + * must accept three parameters: + * + * start_element_handler + * XMLParserparser + * stringname + * arrayattribs + * + * + * + * parser + * + * + * The first parameter, parser, is a + * reference to the XML parser calling the handler. + * + * + * + * + * name + * + * + * The second parameter, name, contains the name + * of the element for which this handler is called.If case-folding is in effect for this + * parser, the element name will be in uppercase letters. + * + * + * + * + * attribs + * + * + * The third parameter, attribs, contains an + * associative array with the element's attributes (if any).The keys + * of this array are the attribute names, the values are the attribute + * values.Attribute names are case-folded on the same criteria as + * element names.Attribute values are not + * case-folded. + * + * + * The original order of the attributes can be retrieved by walking + * through attribs the normal way, using + * each.The first key in the array was the first + * attribute, and so on. + * + * + * + * + * @param callable $end_handler + * @throws XmlException + * + */ +function xml_set_element_handler($parser, callable $start_handler, callable $end_handler): void +{ + error_clear_last(); + $result = \xml_set_element_handler($parser, $start_handler, $end_handler); + if ($result === false) { + throw XmlException::createFromPhpError(); + } +} + + +/** + * Set a handler to be called when leaving the scope of a namespace + * declaration. This will be called, for each namespace declaration, after + * the handler for the end tag of the element in which the namespace was + * declared. + * + * @param resource $parser A reference to the XML parser. + * @param callable $handler handler is a string containing the name of a + * function that must exist when xml_parse is called + * for parser. + * + * The function named by handler must accept + * two parameters, and should return an integer value. If the + * value returned from the handler is FALSE (which it will be if no + * value is returned), the XML parser will stop parsing and + * xml_get_error_code will return + * XML_ERROR_EXTERNAL_ENTITY_HANDLING. + * + * handler + * XMLParserparser + * stringprefix + * + * + * + * parser + * + * + * The first parameter, parser, is a + * reference to the XML parser calling the handler. + * + * + * + * + * prefix + * + * + * The prefix is a string used to reference the namespace within an XML object. + * + * + * + * + * + * If a handler function is set to an empty string, or FALSE, the handler + * in question is disabled. + * @throws XmlException + * + */ +function xml_set_end_namespace_decl_handler($parser, callable $handler): void +{ + error_clear_last(); + $result = \xml_set_end_namespace_decl_handler($parser, $handler); + if ($result === false) { + throw XmlException::createFromPhpError(); + } +} + + +/** + * Sets the external entity reference handler function for the XML parser + * parser. + * + * @param resource $parser A reference to the XML parser to set up external entity reference handler function. + * @param callable $handler handler is a string containing the name of a + * function that must exist when xml_parse is called + * for parser. + * + * The function named by handler must accept + * five parameters, and should return an integer value.If the + * value returned from the handler is FALSE (which it will be if no + * value is returned), the XML parser will stop parsing and + * xml_get_error_code will return + * XML_ERROR_EXTERNAL_ENTITY_HANDLING. + * + * handler + * XMLParserparser + * stringopen_entity_names + * stringbase + * stringsystem_id + * stringpublic_id + * + * + * + * parser + * + * + * The first parameter, parser, is a + * reference to the XML parser calling the handler. + * + * + * + * + * open_entity_names + * + * + * The second parameter, open_entity_names, is a + * space-separated list of the names of the entities that are open for + * the parse of this entity (including the name of the referenced + * entity). + * + * + * + * + * base + * + * + * This is the base for resolving the system identifier + * (system_id) of the external entity.Currently + * this parameter will always be set to an empty string. + * + * + * + * + * system_id + * + * + * The fourth parameter, system_id, is the + * system identifier as specified in the entity declaration. + * + * + * + * + * public_id + * + * + * The fifth parameter, public_id, is the + * public identifier as specified in the entity declaration, or + * an empty string if none was specified; the whitespace in the + * public identifier will have been normalized as required by + * the XML spec. + * + * + * + * + * + * If a handler function is set to an empty string, or FALSE, the handler + * in question is disabled. + * @throws XmlException + * + */ +function xml_set_external_entity_ref_handler($parser, callable $handler): void +{ + error_clear_last(); + $result = \xml_set_external_entity_ref_handler($parser, $handler); + if ($result === false) { + throw XmlException::createFromPhpError(); + } +} + + +/** + * Sets the notation declaration handler function for the XML parser + * parser. + * + * A notation declaration is part of the document's DTD and has the + * following format: + * + * name + * { systemId | publicId?> + * ]]> + * + * See section 4.7 of the XML 1.0 + * spec for the definition of notation declarations. + * + * @param resource $parser A reference to the XML parser to set up notation declaration handler function. + * @param callable $handler handler is a string containing the name of a + * function that must exist when xml_parse is called + * for parser. + * + * The function named by handler must accept + * five parameters: + * + * handler + * XMLParserparser + * stringnotation_name + * stringbase + * stringsystem_id + * stringpublic_id + * + * + * + * + * parser + * + * + * + * The first parameter, parser, is a + * reference to the XML parser calling the handler. + * + * + * + * + * notation_name + * + * + * This is the notation's name, as per + * the notation format described above. + * + * + * + * + * + * base + * + * + * + * This is the base for resolving the system identifier + * (system_id) of the notation declaration. + * Currently this parameter will always be set to an empty string. + * + * + * + * + * system_id + * + * + * System identifier of the external notation declaration. + * + * + * + * + * + * public_id + * + * + * + * Public identifier of the external notation declaration. + * + * + * + * + * + * If a handler function is set to an empty string, or FALSE, the handler + * in question is disabled. + * @throws XmlException + * + */ +function xml_set_notation_decl_handler($parser, callable $handler): void +{ + error_clear_last(); + $result = \xml_set_notation_decl_handler($parser, $handler); if ($result === false) { throw XmlException::createFromPhpError(); } - return $result; } @@ -85,7 +462,7 @@ function xml_parser_create(string $encoding = null) * @throws XmlException * */ -function xml_set_object($parser, object &$object): void +function xml_set_object($parser, object $object): void { error_clear_last(); $result = \xml_set_object($parser, $object); @@ -93,3 +470,247 @@ function xml_set_object($parser, object &$object): void throw XmlException::createFromPhpError(); } } + + +/** + * Sets the processing instruction (PI) handler function for the XML parser + * parser. + * + * A processing instruction has the following format: + * + * <?target + * data?> + * + * + * You can put PHP code into such a tag, but be aware of one limitation: in + * an XML PI, the PI end tag (?>) can not be quoted, + * so this character sequence should not appear in the PHP code you embed + * with PIs in XML documents.If it does, the rest of the PHP code, as well + * as the "real" PI end tag, will be treated as character data. + * + * @param resource $parser A reference to the XML parser to set up processing instruction (PI) handler function. + * @param callable $handler handler is a string containing the name of a + * function that must exist when xml_parse is called + * for parser. + * + * The function named by handler must accept + * three parameters: + * + * handler + * XMLParserparser + * stringtarget + * stringdata + * + * + * + * parser + * + * + * The first parameter, parser, is a + * reference to the XML parser calling the handler. + * + * + * + * + * target + * + * + * The second parameter, target, contains the PI + * target. + * + * + * + * + * data + * + * + * The third parameter, data, contains the PI + * data. + * + * + * + * + * + * If a handler function is set to an empty string, or FALSE, the handler + * in question is disabled. + * @throws XmlException + * + */ +function xml_set_processing_instruction_handler($parser, callable $handler): void +{ + error_clear_last(); + $result = \xml_set_processing_instruction_handler($parser, $handler); + if ($result === false) { + throw XmlException::createFromPhpError(); + } +} + + +/** + * Set a handler to be called when a namespace is declared. Namespace + * declarations occur inside start tags. But the namespace declaration start + * handler is called before the start tag handler for each namespace declared + * in that start tag. + * + * @param resource $parser A reference to the XML parser. + * @param callable $handler handler is a string containing the name of a + * function that must exist when xml_parse is called + * for parser. + * + * The function named by handler must accept + * three parameters, and should return an integer value. If the + * value returned from the handler is FALSE (which it will be if no + * value is returned), the XML parser will stop parsing and + * xml_get_error_code will return + * XML_ERROR_EXTERNAL_ENTITY_HANDLING. + * + * handler + * XMLParserparser + * stringprefix + * stringuri + * + * + * + * parser + * + * + * The first parameter, parser, is a + * reference to the XML parser calling the handler. + * + * + * + * + * prefix + * + * + * The prefix is a string used to reference the namespace within an XML object. + * + * + * + * + * uri + * + * + * Uniform Resource Identifier (URI) of namespace. + * + * + * + * + * + * If a handler function is set to an empty string, or FALSE, the handler + * in question is disabled. + * @throws XmlException + * + */ +function xml_set_start_namespace_decl_handler($parser, callable $handler): void +{ + error_clear_last(); + $result = \xml_set_start_namespace_decl_handler($parser, $handler); + if ($result === false) { + throw XmlException::createFromPhpError(); + } +} + + +/** + * Sets the unparsed entity declaration handler function for the XML parser + * parser. + * + * The handler will be called if the XML parser + * encounters an external entity declaration with an NDATA declaration, like + * the following: + * + * name {publicId | systemId} + * NDATA notationName + * ]]> + * + * + * See section 4.2.2 of + * the XML 1.0 spec for the definition of notation declared + * external entities. + * + * @param resource $parser A reference to the XML parser to set up unparsed entity declaration handler function. + * @param callable $handler handler is a string containing the name of a + * function that must exist when xml_parse is called + * for parser. + * + * The function named by handler must accept six + * parameters: + * + * handler + * XMLParserparser + * stringentity_name + * stringbase + * stringsystem_id + * stringpublic_id + * stringnotation_name + * + * + * + * parser + * + * + * The first parameter, parser, is a + * reference to the XML parser calling the + * handler. + * + * + * + * + * entity_name + * + * + * The name of the entity that is about to be defined. + * + * + * + * + * base + * + * + * This is the base for resolving the system identifier + * (systemId) of the external entity.Currently + * this parameter will always be set to an empty string. + * + * + * + * + * system_id + * + * + * System identifier for the external entity. + * + * + * + * + * public_id + * + * + * Public identifier for the external entity. + * + * + * + * + * notation_name + * + * + * Name of the notation of this entity (see + * xml_set_notation_decl_handler). + * + * + * + * + * + * If a handler function is set to an empty string, or FALSE, the handler + * in question is disabled. + * @throws XmlException + * + */ +function xml_set_unparsed_entity_decl_handler($parser, callable $handler): void +{ + error_clear_last(); + $result = \xml_set_unparsed_entity_decl_handler($parser, $handler); + if ($result === false) { + throw XmlException::createFromPhpError(); + } +} |