src/AssetTrait.php
protected function getAssetData(string $path) : array
    {
        $return = [null, DI::config()->exists('assets/hashes')];

        // file hash
        $hashes = DI::config()->getIfExists('assets/hashes');
        if ($hashes) {
            if (isset($hashes[$path])) {
                $path = $hashes[$path];
            }
        }

        // relative path like "vendor.js", add assets/url
        if (substr($path, 0, 4) != 'http' && // remove "http//host/vendor.js"
            substr($path, 0, 1) != '/' && // remove "/vendor.js" & "//host/vendor.js"
            $assetsPath = DI::config()->get('assets/url')) {
            $path = rtrim($assetsPath, '/') . '/' . $path;
        }

        $host = '';
        if (substr($path, 0, 1) == '/') {
            if (DI::config()->getIfExists('assets/absolute')) {
                $host = self::request()->getUri()->getHostFull();
            } else {
                $host = DI::config()->getIfExists('assets/host');
            }
        }

        $return[0] = (new Uri(null, [Uri::OPTIONS_RELATIVE => empty($host)]))
            ->setPath($path)
            ->setQueries([])
            ->setFragment();

        if ($host) {
            $return[0]->setHostFull($host);
        }

        return $return;
    }
protected function getAssetData(string $path) : array
    {
        $return = [null, DI::config()->exists('assets/hashes')];

        // file hash
        $hashes = DI::config()->getIfExists('assets/hashes');
        if ($hashes) {
            if (isset($hashes[$path])) {
                $path = $hashes[$path];
            }
        }

        // relative path like "vendor.js", add assets/url
        if (substr($path, 0, 4) != 'http' && // remove "http//host/vendor.js"
            substr($path, 0, 1) != '/' && // remove "/vendor.js" & "//host/vendor.js"
            $assetsPath = DI::config()->get('assets/url')) {
            $path = rtrim($assetsPath, '/') . '/' . $path;
        }

        $host = '';
        if (substr($path, 0, 1) == '/') {
            if (DI::config()->getIfExists('assets/absolute')) {
                $host = self::request()->getUri()->getHostFull();
            } else {
                $host = DI::config()->getIfExists('assets/host');
            }
        }

        $return[0] = (new Uri(null, [Uri::OPTIONS_RELATIVE => empty($host)]))
            ->setPath($path)
            ->setQueries([])
            ->setFragment();

        if ($host) {
            $return[0]->setHostFull($host);
        }

        return $return;
    }
protected function getAssetData ( string $ path ) : array { $ return = [ null , DI :: config ( ) -> exists ( 'assets/hashes' ) ] ; // file hash $ hashes = DI :: config ( ) -> getIfExists ( 'assets/hashes' ) ; if ( $ hashes ) { if ( isset ( $ hashes [ $ path ] ) ) { $ path = $ hashes [ $ path ] ; } } // relative path like "vendor.js", add assets/url if ( substr ( $ path , 0 , 4 ) != 'http' && // remove "http//host/vendor.js" substr ( $ path , 0 , 1 ) != '/' && // remove "/vendor.js" & "//host/vendor.js" $ assetsPath = DI :: config ( ) -> get ( 'assets/url' ) ) { $ path = rtrim ( $ assetsPath , '/' ) . '/' . $ path ; } $ host = '' ; if ( substr ( $ path , 0 , 1 ) == '/' ) { if ( DI :: config ( ) -> getIfExists ( 'assets/absolute' ) ) { $ host = self :: request ( ) -> getUri ( ) -> getHostFull ( ) ; } else { $ host = DI :: config ( ) -> getIfExists ( 'assets/host' ) ; } } $ return [ 0 ] = ( new Uri ( null , [ Uri :: OPTIONS_RELATIVE => empty ( $ host ) ] ) ) -> setPath ( $ path ) -> setQueries ( [ ] ) -> setFragment ( ) ; if ( $ host ) { $ return [ 0 ] -> setHostFull ( $ host ) ; } return $ return ; }
@param string $path

@return array<Uri, bool>
@param string $path