src/Twig/AssetExtension.php
public function assetFunction($asset, $serverPath = false) {
        /** @var Request|null $request */
        $request = isset($this->container['request']) ? $this->container['request'] : null;
        $path = \ltrim($asset, '/\\');
        $assetPath = Utils::fixPath($this->container->getRootDir() . '/' . $path);

//        if(!\file_exists($assetPath))
//            throw new FileException("Asset '$asset' with path '$assetPath' not found");

        if(!$serverPath)
            if($request instanceof Request)
                $assetPath = $request->getSchemeAndHttpHost() . '/' . $path;
            else
                $assetPath = '/' . $path;

        return $assetPath;
    }
public function assetFunction($asset, $serverPath = false) {
        /** @var Request|null $request */
        $request = isset($this->container['request']) ? $this->container['request'] : null;
        $path = \ltrim($asset, '/\\');
        $assetPath = Utils::fixPath($this->container->getRootDir() . '/' . $path);

//        if(!\file_exists($assetPath))
//            throw new FileException("Asset '$asset' with path '$assetPath' not found");

        if(!$serverPath)
            if($request instanceof Request)
                $assetPath = $request->getSchemeAndHttpHost() . '/' . $path;
            else
                $assetPath = '/' . $path;

        return $assetPath;
    }
Return fixed asset's path.

@param string $asset      Path to the asset
@param bool   $serverPath Server-related path or web-related

@throws FileException File does not exist on server

@return string