Laravel Hetzner Storagebox

PHP MIT

Production-ready Laravel package for integrating Hetzner Storage Box into Laravel applications using the native Storage facade and filesystem API.

Stars
19
Forks
0
Downloads
2,357
Open Issues
0
Files main

Repository Files

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

namespace GhostCompiler\Hetzner\StorageBox\DTOs;

class Action
{
    public int $id;

    public string $command;

    public string $status;

    public int $progress;

    public string $started;

    public ?string $finished = null;

    public array $resources = [];

    public ?array $error = null;

    /**
     * Create a new DTO instance from array data.
     */
    public static function fromArray(array $data): self
    {
        $action = new self;
        $action->id = (int) ($data['id'] ?? 0);
        $action->command = (string) ($data['command'] ?? '');
        $action->status = (string) ($data['status'] ?? '');
        $action->progress = (int) ($data['progress'] ?? 0);
        $action->started = (string) ($data['started'] ?? '');
        $action->finished = isset($data['finished']) ? (string) $data['finished'] : null;
        $action->resources = (array) ($data['resources'] ?? []);
        $action->error = isset($data['error']) ? (array) $data['error'] : null;

        return $action;
    }
}