forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: XML API: Introduce XML Processor.
See also adamziel#44 See also adamziel#43 See also https://github.com/WordPress/wordpress-develop/compare/trunk...sirreal:wordpress-develop:xml-processor-continue?expand=1
- Loading branch information
Showing
3 changed files
with
467 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
class WP_XML_Malformed_Error extends ValueError { | ||
public $level_of_concern; | ||
|
||
public function __construct( int $level_of_concern, string $message ) { | ||
parent::__construct( $message ); | ||
$this->level_of_concern = $level_of_concern; | ||
} | ||
|
||
public function get_level_of_concern(): int { | ||
switch ( $this->level_of_concern ) { | ||
case WP_XML_Processor::CONCERNED_ABOUT_EVERYTHING: | ||
return 'EVERYTHING'; | ||
|
||
case WP_XML_Processor::CONCERNED_ABOUT_CONTENT: | ||
return 'CONTENT'; | ||
|
||
case WP_XML_Processor::CONCERNED_ABOUT_BENIGN_SYNTAX: | ||
return 'BENIGN_SYNTAX'; | ||
|
||
case WP_XML_Processor::CONCERNED_ABOUT_INVALID_SYNTAX: | ||
return 'INVALID_SYNTAX'; | ||
|
||
case WP_XML_Processor::CONCERNED_ABOUT_UNRESOLVABLES: | ||
return 'UNRESOLVABLE'; | ||
|
||
default: | ||
throw new ValueError( "Unknown level of concern: {$this->level_of_concern}" ); | ||
} | ||
} | ||
} |
Oops, something went wrong.