Laravel Hetzner Robot

PHP MIT

Laravel SDK for the Hetzner Robot API with fluent resources, type-safe responses, failover IP management, dedicated server automation, and seamless Laravel integration.

Stars
20
Forks
0
Downloads
2,250
Open Issues
0
Files main

Repository Files

Loading file structure...
src/DTOs/Vnc.php
<?php

namespace Vendor\HetznerRobot\DTOs;

class Vnc
{
    public string $serverIp;

    public string $serverIpv6Net;

    public int $serverNumber;

    /**
     * @var array|string
     */
    public $dist;

    /**
     * @var array|string
     */
    public $lang;

    public bool $active;

    public ?string $password = null;

    public static function fromArray(array $data): self
    {
        $vnc = new self;
        $vnc->serverIp = (string) ($data['server_ip'] ?? '');
        $vnc->serverIpv6Net = (string) ($data['server_ipv6_net'] ?? '');
        $vnc->serverNumber = (int) ($data['server_number'] ?? 0);
        $vnc->dist = $data['dist'] ?? [];
        $vnc->lang = $data['lang'] ?? [];
        $vnc->active = (bool) ($data['active'] ?? false);
        $vnc->password = isset($data['password']) ? (string) $data['password'] : null;

        return $vnc;
    }
}