EasyPost\Object::constructFrom PHP Method

constructFrom() public static method

construct from
public static constructFrom ( array $values, string $class = null, string $apiKey = null, string $parent = null, string $name = null ) : mixed
$values array
$class string
$apiKey string
$parent string
$name string
return mixed
    public static function constructFrom($values, $class = null, $apiKey = null, $parent = null, $name = null)
    {
        if ($class === null) {
            $class = get_class();
        }
        $obj = new $class(isset($values['id']) ? $values['id'] : null, $apiKey, $parent, $name);
        $obj->refreshFrom($values, $apiKey);
        return $obj;
    }