Documentation

VultrUtil
in package

Table of Contents

Methods

convertCamelCaseToUnderscore()  : string
convertJSONToObject()  : ModelInterface
convertUnderscoreToCamelCase()  : string
decodeJSON()  : stdClass|array<string|int, mixed>
getLevel()  : int
Get Status Code level
initJSONMapper()  : JsonMapper
mapObject()  : ModelInterface

Methods

convertCamelCaseToUnderscore()

public static convertCamelCaseToUnderscore( $camelCase[,  $lowercase = true ]) : string
Parameters
$camelCase :
  • string - a camel cased string that will be converted to underscore notation
$lowercase : = true
  • bool - whether the string will be all lowercase or not.
Return values
string

convertJSONToObject()

public static convertJSONToObject( $json,  $model[,  $prop = null ]) : ModelInterface
Parameters
$json :
  • string - Raw JSON
$model :
  • A model that will be used to map the json response to the object. Model is passed in via reference, the model will immediately be reset before its mapped and cloned.
$prop : = null
  • The arching prop that has the contents that we will map the object to. Ex a Backup object will have "backup" : { 'id', etc etc} So in $prop we would specifiy "backup"
Tags
throws
VultrException
Return values
ModelInterface

convertUnderscoreToCamelCase()

public static convertUnderscoreToCamelCase(string $key) : string
Parameters
$key : string
Return values
string

decodeJSON()

public static decodeJSON(string $json[, bool $array = false ]) : stdClass|array<string|int, mixed>
Parameters
$json : string
$array : bool = false
Return values
stdClass|array<string|int, mixed>

getLevel()

Get Status Code level

public static getLevel(ResponseInterface $response) : int
Parameters
$response : ResponseInterface
Return values
int

initJSONMapper()

public static initJSONMapper() : JsonMapper
Return values
JsonMapper

mapObject()

public static mapObject(stdClass $stdclass,  $model[,  $prop = null ]) : ModelInterface
Parameters
$stdclass : stdClass
$model :
  • A model that will be used to map the json response to the object. Model is passed in via reference, the model will immediately be reset before its mapped and cloned.
$prop : = null
  • The arching prop that has the contents that we will map the object to. Ex a Backup object will have "backup" : { 'id', etc etc} So in $prop we would specifiy "backup"
Tags
throws
VultrException
Return values
ModelInterface

        
On this page

Search results