HEX
Server: LiteSpeed
System: Linux sv4.hami.host 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64
User: armgroup (1008)
PHP: 8.2.32
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, mail, socket_create, socket_create_listen, socket_create_pair, link, dl, openlog, syslog, stream_socket_server, curl_multi_init
Upload Files
File: /home/armgroup/libs/packages/consoletvs/charts/src/BaseChart.php
<?php

declare(strict_types=1);

namespace ConsoleTVs\Charts;

use Chartisan\PHP\Chartisan;
use Illuminate\Http\Request;
use ReflectionClass;

abstract class BaseChart
{
    /**
     * Determines the chart name to be used on the
     * route. If null, the name will be a snake_case
     * version of the class name.
     */
    public ?string $name;

    /**
     * Determines the name suffix of the chart route.
     * This will also be used to get the chart URL
     * from the blade directrive. If null, the chart
     * name will be used.
     */
    public ?string $routeName;

    /**
     * Determines the prefix that will be used by the chart
     * endpoint.
     */
    public ?string $prefix;

    /**
     * Determines the middlewares that will be applied
     * to the chart endpoint.
     */
    public ?array $middlewares;

    /**
     * Handles the HTTP request of the chart. This must always
     * return the chart instance. Do not return a string or an array.
     */
    abstract public function handler(Request $request): Chartisan;

    public static function __set_state(array $properties)
    {
        $klass = new static;

        $refClass = new ReflectionClass($klass);

        foreach ($properties as $name => $value) {
            $property = $refClass->getProperty($name);
            $property->setAccessible(true);

            $property->setValue($klass, $value);
        }

        return $klass;
    }
}