src/Asset/Finder.php
public function find(string $path): AssetFileInterface
    {
        if ($this->isExternal($path)) {
            return (new File($this->files))
                ->setPath('')
                ->setUrl($path)
                ->setExternal(true)
                ->setType($path);
        }

        $path = trim($path, '\/');

        foreach ($this->locations as $dir => $url) {
            if ($this->files->exists($fullPath = $dir.'/'.$path)) {
                return (new File($this->files))
                    ->setPath($fullPath)
                    ->setUrl($url.'/'.$path)
                    ->setExternal(false)
                    ->setType($fullPath);
            }
        }

        throw new AssetException('Unable to find the asset with the following path: '.$path);
    }
public function find(string $path): AssetFileInterface
    {
        if ($this->isExternal($path)) {
            return (new File($this->files))
                ->setPath('')
                ->setUrl($path)
                ->setExternal(true)
                ->setType($path);
        }

        $path = trim($path, '\/');

        foreach ($this->locations as $dir => $url) {
            if ($this->files->exists($fullPath = $dir.'/'.$path)) {
                return (new File($this->files))
                    ->setPath($fullPath)
                    ->setUrl($url.'/'.$path)
                    ->setExternal(false)
                    ->setType($fullPath);
            }
        }

        throw new AssetException('Unable to find the asset with the following path: '.$path);
    }
public function find ( string $ path ) : AssetFileInterface { if ( $ this -> isExternal ( $ path ) ) { return ( new File ( $ this -> files ) ) -> setPath ( '' ) -> setUrl ( $ path ) -> setExternal ( true ) -> setType ( $ path ) ; } $ path = trim ( $ path , '\/' ) ; foreach ( $ this -> locations as $ dir => $ url ) { if ( $ this -> files -> exists ( $ fullPath = $ dir . '/' . $ path ) ) { return ( new File ( $ this -> files ) ) -> setPath ( $ fullPath ) -> setUrl ( $ url . '/' . $ path ) -> setExternal ( false ) -> setType ( $ fullPath ) ; } } throw new AssetException ( 'Unable to find the asset with the following path: ' . $ path ) ; }
Return an asset file instance if found.

@param string $path

@throws AssetException

@return AssetFileInterface
Return an asset file instance if found .