HEX
Server: Apache
System: Linux webm013.cluster123.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: lesanew (165608)
PHP: 8.3.31
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/lesanew/anestetues2/vendor/roots/acorn/src/Roots/Acorn/View/Composers/Concerns/Arrayable.php
<?php

namespace Roots\Acorn\View\Composers\Concerns;

use Illuminate\Support\Fluent;
use Illuminate\Support\Str;
use ReflectionClass;
use ReflectionMethod;
use Throwable;

trait Arrayable
{
    /**
     * Map the public class methods to an array.
     *
     * @return array
     */
    public function toArray()
    {
        return collect((new ReflectionClass(static::class))->getMethods(ReflectionMethod::IS_PUBLIC))
            ->reject(fn ($method) => $this->shouldIgnore($method->name) || $method->isStatic())
            ->mapWithKeys(function ($method) {
                try {
                    $data = $this->{$method->name}();

                    return [Str::snake($method->name) => is_array($data) ? new Fluent($data) : $data];
                } catch (Throwable) {
                    return [];
                }
            })
            ->filter()
            ->all();
    }
}