HEX
Server: LiteSpeed
System: Linux s3.sitechai.com 4.18.0-553.51.1.lve.1.el8.x86_64 #1 SMP Wed May 14 14:34:57 UTC 2025 x86_64
User: workzeni (2217)
PHP: 8.1.32
Disabled: mail, show_source, system, shell_exec, passthru, exec, eval, shell
Upload Files
File: //home/workzeni/agency-erp-05.workzenix.com/vendor/livewire/volt/src/Actions/CallMethod.php
<?php

namespace Livewire\Volt\Actions;

use Closure;
use Livewire\Exceptions\PropertyNotFoundException;
use Livewire\Volt\CompileContext;
use Livewire\Volt\Component;
use Livewire\Volt\Contracts\Action;
use Livewire\Volt\Methods\Method;
use Livewire\Volt\Support\Reflection;

class CallMethod implements Action
{
    /**
     * Create a new action instance.
     */
    public function __construct(protected string $methodName) {}

    /**
     * {@inheritDoc}
     */
    public function execute(CompileContext $context, Component $component, array $arguments): mixed
    {
        $method = $context->variables["{$this->methodName}"];

        $method = $method instanceof Method ? $method->reflection()->closure : $method;

        $method = Closure::bind($method, $component, $component::class);

        try {
            return call_user_func_array($method, $arguments);
        } catch (PropertyNotFoundException $e) {
            $propertyName = explode(
                ' ', preg_replace('/Property \[\$(.*)\] not found on component:/', '$1', $e->getMessage())
            )[0];

            Reflection::setExceptionMessage(
                $e, "State definition for [$propertyName] not found on component [{$component->voltComponentName()}]."
            );

            throw $e;
        }
    }
}