Back to WebAssetItem class

Method resolvePath

protected string
resolvePath
(string $path, string $type)
Resolve path
Parameters
  • string $path The path to resolve
  • string $type The resolver method
Returns
  • string
Since
  • 4.0.0
Class: WebAssetItem
Project: Joomla

Method resolvePath - Source code

/**
 * Resolve path
 *
 * @param   string  $path  The path to resolve
 * @param   string  $type  The resolver method
 *
 * @return string
 *
 * @since  4.0.0
 */
protected function resolvePath(string $path, string $type) : string
{
    if ($type !== 'script' && $type !== 'stylesheet') {
        throw new \UnexpectedValueException('Unexpected [type], expected "script" or "stylesheet"');
    }
    $file = $path;
    $external = $this->isPathExternal($path);
    if (!$external) {
        // Get the file path
        $file = HTMLHelper::_($type, $path, ['pathOnly' => true, 'relative' => !$this->isPathAbsolute($path)]);
    }
    return $file ?? '';
}