lib/Dropbox/Host.php
static function loadFromJson($jsonObj)
    {
        // Check for the optional 'auth_host' and 'host_suffix' fields.
        $authHost = null;
        if (array_key_exists('auth_host', $jsonObj)) {
            $authHost = $jsonObj["auth_host"];
            if (!is_string($authHost)) {
                throw new HostLoadException("Optional field \"auth_host\" must be a string");
            }
        }
        $hostSuffix = null;
        if (array_key_exists('host_suffix', $jsonObj)) {
            $hostSuffix = $jsonObj["host_suffix"];
            if (!is_string($hostSuffix)) {
                throw new HostLoadException("Optional field \"host_suffix\" must be a string");
            }
        }

        if ($authHost === null && $hostSuffix === null) return null;

        if ($authHost === null) {
            throw new HostLoadException("Can't provide \"host_suffix\" without providing \"auth_host\".");
        }
        if ($hostSuffix === null) {
            throw new HostLoadException("Can't provide \"auth_host\" without providing \"host_suffix\".");
        }
        $api = "api".$hostSuffix;
        $content = "content".$hostSuffix;
        $web = $authHost;
        return new Host($api, $content, $web);
    }
static function loadFromJson($jsonObj)
    {
        // Check for the optional 'auth_host' and 'host_suffix' fields.
        $authHost = null;
        if (array_key_exists('auth_host', $jsonObj)) {
            $authHost = $jsonObj["auth_host"];
            if (!is_string($authHost)) {
                throw new HostLoadException("Optional field \"auth_host\" must be a string");
            }
        }
        $hostSuffix = null;
        if (array_key_exists('host_suffix', $jsonObj)) {
            $hostSuffix = $jsonObj["host_suffix"];
            if (!is_string($hostSuffix)) {
                throw new HostLoadException("Optional field \"host_suffix\" must be a string");
            }
        }

        if ($authHost === null && $hostSuffix === null) return null;

        if ($authHost === null) {
            throw new HostLoadException("Can't provide \"host_suffix\" without providing \"auth_host\".");
        }
        if ($hostSuffix === null) {
            throw new HostLoadException("Can't provide \"auth_host\" without providing \"host_suffix\".");
        }
        $api = "api".$hostSuffix;
        $content = "content".$hostSuffix;
        $web = $authHost;
        return new Host($api, $content, $web);
    }
static function loadFromJson ( $ jsonObj ) { // Check for the optional 'auth_host' and 'host_suffix' fields. $ authHost = null ; if ( array_key_exists ( 'auth_host' , $ jsonObj ) ) { $ authHost = $ jsonObj [ "auth_host" ] ; if ( ! is_string ( $ authHost ) ) { throw new HostLoadException ( "Optional field \"auth_host\" must be a string" ) ; } } $ hostSuffix = null ; if ( array_key_exists ( 'host_suffix' , $ jsonObj ) ) { $ hostSuffix = $ jsonObj [ "host_suffix" ] ; if ( ! is_string ( $ hostSuffix ) ) { throw new HostLoadException ( "Optional field \"host_suffix\" must be a string" ) ; } } if ( $ authHost === null && $ hostSuffix === null ) return null ; if ( $ authHost === null ) { throw new HostLoadException ( "Can't provide \"host_suffix\" without providing \"auth_host\"." ) ; } if ( $ hostSuffix === null ) { throw new HostLoadException ( "Can't provide \"auth_host\" without providing \"host_suffix\"." ) ; } $ api = "api" . $ hostSuffix ; $ content = "content" . $ hostSuffix ; $ web = $ authHost ; return new Host ( $ api , $ content , $ web ) ; }
Loads a Host object from the 'auth_host' and 'host_suffix' fields of a JSON object.
If those fields aren't present, return `null`.

@return Host|null

@throws HostLoadException
Loads a Host object from the auth_host and host_suffix fields of a JSON object . If those fields aren t present return null .