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/StorageBoxSnapshot.php
<?php

namespace Vendor\HetznerRobot\DTOs;

class StorageBoxSnapshot
{
    public string $name;

    public string $timestamp;

    public int $size;

    public ?int $filesystemSize = null;

    public ?bool $automatic = null;

    public ?string $comment = null;

    public static function fromArray(array $data): self
    {
        $snapshot = new self;
        $snapshot->name = (string) ($data['name'] ?? '');
        $snapshot->timestamp = (string) ($data['timestamp'] ?? '');
        $snapshot->size = (int) ($data['size'] ?? 0);
        $snapshot->filesystemSize = isset($data['filesystem_size']) ? (int) $data['filesystem_size'] : null;
        $snapshot->automatic = isset($data['automatic']) ? (bool) $data['automatic'] : null;
        $snapshot->comment = isset($data['comment']) ? (string) $data['comment'] : null;

        return $snapshot;
    }
}