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/ComponentResolver.php
<?php

namespace Livewire\Volt;

use Illuminate\Support\Facades\File;

class ComponentResolver
{
    /**
     * Create a new component resolver instance.
     */
    public function __construct(
        protected ComponentFactory $factory
    ) {}

    /**
     * Attempt to resolve the given component name into a Volt component class name.
     *
     * @param  array<int, string>  $paths
     */
    public function resolve(string $alias, array $paths): ?string
    {
        foreach ($paths as $path) {
            if (File::exists($possiblePath = $path.'/'.str_replace('.', '/', $alias).'.blade.php')) {
                return $this->extractComponentClass($alias, realpath($possiblePath));
            } elseif (is_array($component = FragmentAlias::decode($alias))) {
                return $this->extractComponentClass($alias, realpath($component['path']));
            }
        }

        return null;
    }

    /**
     * Extract the component class from the given file.
     */
    protected function extractComponentClass(string $componentName, string $componentPath): string
    {
        return $this->factory->make($componentName, $componentPath);
    }
}