Debug_Bar_Pretty_Output::get_ooutput PHP Method

get_ooutput() public static method

Retrieves html string of properties in a table and methods in an unordered list.
Since: 1.3
public static get_ooutput ( object $obj, boolean $is_sub = false )
$obj object Object for which to show the properties and methods.
$is_sub boolean (internal) Top level or nested object.
        public static function get_ooutput($obj, $is_sub = false)
        {
            $properties = get_object_vars($obj);
            $methods = get_class_methods($obj);
            $output = '';
            if (false === $is_sub) {
                $output .= '
		<h2><span>' . esc_html__('Properties:', 'db-pretty-output') . '</span>' . count($properties) . '</h2>';
                $output .= '
		<h2><span>' . esc_html__('Methods:', 'db-pretty-output') . '</span>' . count($methods) . '</h2>';
            }
            // Properties.
            if (!empty($properties) && is_array($properties)) {
                $h = 'h4';
                if (false === $is_sub) {
                    $h = 'h3';
                }
                $output .= '
		<' . $h . '>' . esc_html__('Object Properties:', 'db-pretty-output') . '</' . $h . '>';
                uksort($properties, 'strnatcasecmp');
                $output .= self::get_table($properties, __('Property', 'db-pretty-output'), __('Value', 'db-pretty-output'));
            }
            // Methods.
            if (!empty($methods) && is_array($methods)) {
                $output .= '
		<h3>' . esc_html__('Object Methods:', 'db-pretty-output') . '</h3>
		<ul class="' . sanitize_html_class(self::NAME) . '">';
                uksort($methods, 'strnatcasecmp');
                foreach ($methods as $method) {
                    $output .= '<li>' . esc_html($method) . '()</li>';
                }
                unset($method);
                $output .= '</ul>';
            }
            return $output;
        }