Laravel Cloudflare

PHP MIT

Complete Laravel Cloudflare API SDK for managing DNS records, zones, cache, SSL, firewall rules, workers, analytics, and Cloudflare services with a fluent Laravel-first developer experience.

Stars
2
Forks
0
Downloads
N/A
Open Issues
0
Files main

Repository Files

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

namespace Vendor\Cloudflare\DTOs;

class PageRule
{
    public string $id;

    public array $targets;

    public array $actions;

    public int $priority;

    public string $status;

    public string $created_on;

    public string $modified_on;

    /**
     * Create a new DTO instance from array data.
     */
    public static function fromArray(array $data): self
    {
        $dto = new self;
        $dto->id = (string) ($data['id'] ?? '');
        $dto->targets = (array) ($data['targets'] ?? []);
        $dto->actions = (array) ($data['actions'] ?? []);
        $dto->priority = (int) ($data['priority'] ?? 0);
        $dto->status = (string) ($data['status'] ?? '');
        $dto->created_on = (string) ($data['created_on'] ?? '');
        $dto->modified_on = (string) ($data['modified_on'] ?? '');

        return $dto;
    }
}