This method returns a local pathname to an asset.

@param string $assetName

@throws DAV\Exception\NotFound

@return string
770503
protected function getLocalAssetPath($assetName)
    {
        $assetDir = __DIR__.'/assets/';
        $path = $assetDir.$assetName;

        // Making sure people aren't trying to escape from the base path.
        $path = str_replace('\\', '/', $path);
        if (false !== strpos($path, '/../') || '/..' === strrchr($path, '/')) {
            throw new DAV\Exception\NotFound('Path does not exist, or escaping from the base path was detected');
        }
        $realPath = realpath($path);
        if ($realPath && 0 === strpos($realPath, realpath($assetDir)) && file_exists($path)) {
            return $path;
        }
        throw new DAV\Exception\NotFound('Path does not exist, or escaping from the base path was detected');
    }
426555
public function getAssetFile($type, $assetName)
    {
        if (!$this->hasAsset($type, $assetName)) {
            return false;
        }
    
        // Sort the files by dependnecies
        $file = $this->assets[$type][$assetName];
    
        return $file;
    }
146618
protected function getAsset($name) {
		$path  = $this->assetsPath . DIRECTORY_SEPARATOR . $name;
		$asset = file_get_contents($path);
		
		if ($asset === false) {
			throw new InvalidPath('Unable to get asset "' . $name . '" by path "' . $path . '"');
		}
		
		return $asset;
	}
1272167
public function getFilePath($fileName = null)
    {
        if ($fileName === null) {
            $fileName = $this->fileName;
        }

        return $this->theme->getPath().'/'.$this->dirName.'/'.$fileName;
    }
138581
public function fileName($fileName = null)
    {
        if (func_num_args() > 0) {
            $parts = pathinfo($this->_name);
            $this->_name = "{$parts['dirname']}/{$fileName}.{$parts['extension']}";
            return $this;
        }
        return pathinfo($this->_name, PATHINFO_FILENAME);
    }
1305014
public function getFilePath($filename)
    {
        if (modules()) {
            $filePaths = modules()->getDirs('Views');
        } else {
            $filePaths = array_reverse($this->filePaths);
        }

        foreach ($filePaths as $filePath) {
            if (is_file($filePath . $filename . '.phtml')) {
                return $filePath . $filename . '.phtml';
                break;
            } elseif (is_file($filePath . 'errors' . DIRECTORY_SEPARATOR . $filename . '.phtml')) {
                return $filePath . 'errors' . DIRECTORY_SEPARATOR . $filename . '.phtml';
                break;
            }
        }
    }
111087
public static function getTransformPathForAsset($asset): string
    {
        /** @var Volume $volume */
        try {
            $volume = $asset->getVolume();
        } catch (InvalidConfigException $e) {
            \Craft::error($e->getMessage(), __METHOD__);
            throw new ImagerException($e->getMessage(), $e->getCode(), $e);
        }

        /** @var ConfigModel $settings */
        $config = ImagerService::getConfig();

        $hashPath = $config->hashPath;
        $addVolumeToPath = $config->addVolumeToPath;

        if ($hashPath) {
            return FileHelper::normalizePath('/' . md5('/' . ($addVolumeToPath ? mb_strtolower($volume->handle) . '/' : '') . $asset->folderPath . '/') . '/' . $asset->id . '/');
        }

        return FileHelper::normalizePath('/' . ($addVolumeToPath ? mb_strtolower($volume->handle) . '/' : '') . $asset->folderPath . '/' . $asset->id . '/');
    }
527481
public function asset($filename = null)
    {
        $path = rtrim($this->config->get('plates.assets'), '/');

        if ($path && strpos($path, '://') === false && strpos($path, '//') !== 0) {
            $path = '/' . ltrim($path, '/');
        }

        $filename = ltrim($filename, '/');
        if (!$filename) {
            return $path;
        }

        return $path . '/' . $filename;
    }
198640
public function getAssetDirectory($moduleName = null)
    {
        if ($moduleName)
            return public_path().'/'.$this->getConfig('assets').'/'.$moduleName;

        return public_path().'/'.$this->getConfig('assets').'/';
    }
506807
public function getPathFromFile($filename)
	{
		$i = strrpos($filename, self::getSlash());

		if ($i!== false)
		{
			return substr($filename, 0, $i);
		}
		else
		{
			return $filename;
		}
	}
363371
public function getAssetPath()
    {
        $path = $this->assetsHelper->getUrl('');

        if ($path[strlen($path) - 1] === '/') {
            $path = rtrim($path, '/');
        }

        return $path;
    }
498329
public Configurator fromAsset(String assetName) {
        try {
            File pdfFile = FileUtils.fileFromAsset(getContext(), assetName);
            return fromFile(pdfFile);
        } catch (IOException e) {
            throw new FileNotFoundException(assetName + " does not exist.", e);
        }
    }
853175
private function getPathsForLocalAsset(Asset $image)
    {
        /** @var LocalVolumeInterface $volume */
        try {
            $volume = $image->getVolume();
            $this->transformPath = ImagerHelpers::getTransformPathForAsset($image);
        } catch (InvalidConfigException $e) {
            Craft::error($e->getMessage(), __METHOD__);
            throw new ImagerException($e->getMessage(), $e->getCode(), $e);
        }

        $this->path = FileHelper::normalizePath($volume->getRootPath().'/'.$image->folderPath);
        $this->url = $image->getUrl();
        $this->filename = $image->getFilename();
        $this->basename = $image->getFilename(false);
        $this->extension = $image->getExtension();
    }
675157
public function asset(string $path, string $assetSite = null): string
    {
        if (strlen($path) == 0) {
            throw new \InvalidArgumentException('Expected non-empty string');
        }

        // if you pass the full URL that contains "//" part, it'll be immediately
        // returned without any kind of building or parsing

        $pos = strpos($path, '//');
        if (($pos !== false && $pos < 10) || substr($path, 0, 2) == '//') {
            return $path;
        }

        $assets = Application::getConfig('application')->get('assets') ?? [];

        if ($path[0] != '/') {
            $path = '/' . $path;
        }

        $url = null;

        if ($assetSite != null) {
            if (isset($assets[$assetSite])) {
                $url = $assets[$assetSite];
            } else {
                $backtrace = debug_backtrace();
                $caller = $backtrace[1]['function'] ?? '[unknown caller]'; // TODO: Possible fix needed
                Log::warning("Asset site {$assetSite} is used in {$caller}, but not set in application config; using first asset site if any");

                if (count($assets) > 0) {
                    $url = array_values($assets)[0];
                }
            }
        } else {
            if (count($assets) > 0) {
                $url = array_values($assets)[0];
            }
        }

        if ($url == null) {
            return static::makeUrl($path);
        } else {
            if (substr($url, -1) != '/') {
                $url .= '/';
            }

            if (substr($path, 0, 1) == '/') {
                $path = substr($path, 1);
            }

            return $url . $path;
        }
    }
451996
public function GetAsset($AssetName) {
      if (!array_key_exists($AssetName, $this->Assets))
         return '';
      if (!is_array($this->Assets[$AssetName]))
         return $this->Assets[$AssetName];
      
      // Include the module sort
      $Modules = Gdn::Config('Modules', array());
      if ($this->ModuleSortContainer === FALSE)
         $ModuleSort = FALSE; // no sort wanted
      elseif (array_key_exists($this->ModuleSortContainer, $Modules) && array_key_exists($AssetName, $Modules[$this->ModuleSortContainer]))
         $ModuleSort = $Modules[$this->ModuleSortContainer][$AssetName]; // explicit sort
      elseif (array_key_exists($this->Application, $Modules) && array_key_exists($AssetName, $Modules[$this->Application]))
         $ModuleSort = $Modules[$this->Application][$AssetName]; // application default sort

      // Get all the assets for this AssetContainer
      $ThisAssets = $this->Assets[$AssetName];
      $Assets = array();
      
      if (isset($ModuleSort) && is_array($ModuleSort)) {
         // There is a specified sort so sort by it.
         foreach ($ModuleSort as $Name) {
            if (array_key_exists($Name, $ThisAssets)) {
               $Assets[] = $ThisAssets[$Name];
               unset($ThisAssets[$Name]);
            }
         }
      }
      
      // Pick up any leftover assets that werent explicitly sorted
      foreach ($ThisAssets as $Name => $Asset)
         $Assets[] = $Asset;
         
      if (count($Assets) == 0) {
         return '';
      } elseif (count($Assets) == 1) {
         return $Assets[0];
      } else {
         $Result = new Gdn_ModuleCollection();
         $Result->Items = $Assets;
         return $Result;
      }
   }
247977
public function asset($asset, $version = null)
    {
        $host = $this->request->getHost();
        $port = $this->request->getPort();
        $path = $this->request->getBasePath();

        if ('/' !== substr($asset, 1)) {
            $asset = '/'.$asset;
        }

        if (80 === $port) {
            $port = '';
        } else {
            $port = ':'.$port;
        }

        return '//'.$host.$port.$path.$asset;
    }
1320702
private function getTheme($themeName)
    {
        $theme = $this->themeRepository->findOneByName($themeName);
        if (null === $theme) {
            throw new NotFoundHttpException(sprintf('Theme with name "%s" not found', $themeName));
        }

        return $theme;
    }