ResultPrinter::printObject PHP Method

printObject() protected static method

protected static printObject ( $object, $error = null )
    protected static function printObject($object, $error = null)
    {
        if ($error) {
            echo '<p class="error"><i class="fa fa-exclamation-triangle"></i> ' . $error . '</p>';
        }
        if ($object) {
            if (is_a($object, 'PayPal\\Common\\PayPalModel')) {
                /** @var $object \PayPal\Common\PayPalModel */
                echo '<pre class="prettyprint ' . ($error ? 'error' : '') . '">' . $object->toJSON(128) . "</pre>";
            } elseif (is_string($object) && \PayPal\Validation\JsonValidator::validate($object, true)) {
                echo '<pre class="prettyprint ' . ($error ? 'error' : '') . '">' . str_replace('\\/', '/', json_encode(json_decode($object), 128)) . "</pre>";
            } elseif (is_string($object)) {
                echo '<pre class="prettyprint ' . ($error ? 'error' : '') . '">' . $object . '</pre>';
            } else {
                echo "<pre>";
                print_r($object);
                echo "</pre>";
            }
        } else {
            echo "<span>No Data</span>";
        }
    }