Add missing documentation

This commit is contained in:
Justin Foell
2019-02-01 14:17:22 -06:00
parent 629d8c3c59
commit 9813dc2aec
6 changed files with 41 additions and 24 deletions
+24 -2
View File
@@ -38,18 +38,32 @@ class WPStrava_Exception extends WPStrava_Abstract_Exception {
*
* @param WP_Error $error
* @return WPStrava_Exception
* @author Justin Foell <justin.foell@webdevstudios.com>
* @since
* @author Justin Foell <justin@foell.org>
* @since 1.6.0
*/
public static function from_wp_error( WP_Error $error ) {
$class = __CLASS__;
return new $class( $error->get_error_message( $error->get_error_code() ) );
}
/**
* HTML version of this exception.
*
* @return string The exception string wrapped in <pre> tags.
* @author Justin Foell <justin@foell.org>
* @since 1.6.0
*/
public function to_html() {
return '<pre>' . $this . '</pre>';
}
/**
* Magic method to convert this exception to a string.
*
* @return string
* @author Justin Foell <justin@foell.org>
* @since 1.6.0
*/
public function __toString() {
if ( WPSTRAVA_DEBUG && $this->getPrevious() ) {
return $this->get_formatted_message( $this->getPrevious() );
@@ -58,6 +72,14 @@ class WPStrava_Exception extends WPStrava_Abstract_Exception {
return $this->get_formatted_message( $this );
}
/**
* Exception message with extra formatting.
*
* @param Exception $exception
* @return string Formatted exception message.
* @author Justin Foell <justin@foell.org>
* @since 1.6.0
*/
public function get_formatted_message( $exception ) {
$code = $exception->getCode();