original_string: public function assetUrl($path, array $options = [])
      {
          if (is_array($path)) {
              return $this->build($path, !empty($options['fullBase']));
          }
          // data URIs only require HTML escaping
          if (preg_match('/^data:[a-z]+\/[a-z]+;/', $path)) {
              return h($path);
          }
          if (strpos($path, '://') !== false || preg_match('/^[a-z]+:/i', $path)) {
              return ltrim($this->build($path), '/');
          }
          if (!array_key_exists('plugin', $options) || $options['plugin'] !== false) {
              list($plugin, $path) = $this->_View->pluginSplit($path, false);
          }
          if (!empty($options['pathPrefix']) && $path[0] !== '/') {
              $path = $options['pathPrefix'] . $path;
          }
          if (!empty($options['ext']) &&
              strpos($path, '?') === false &&
              substr($path, -strlen($options['ext'])) !== $options['ext']
          ) {
              $path .= $options['ext'];
          }
          if (preg_match('|^([a-z0-9]+:)?//|', $path)) {
              return $this->build($path);
          }
          if (isset($plugin)) {
              $path = Inflector::underscore($plugin) . '/' . $path;
          }
  
          $optionTimestamp = null;
          if (array_key_exists('timestamp', $options)) {
              $optionTimestamp = $options['timestamp'];
          }
          $webPath = $this->assetTimestamp($this->webroot($path), $optionTimestamp);
  
          $path = $this->_encodeUrl($webPath);
  
          if (!empty($options['fullBase'])) {
              $fullBaseUrl = is_string($options['fullBase']) ? $options['fullBase'] : Router::fullBaseUrl();
              $path = rtrim($fullBaseUrl, '/') . '/' . ltrim($path, '/');
          }
  
          return $path;
      }
code: public function assetUrl($path, array $options = [])
      {
          if (is_array($path)) {
              return $this->build($path, !empty($options['fullBase']));
          }
          // data URIs only require HTML escaping
          if (preg_match('/^data:[a-z]+\/[a-z]+;/', $path)) {
              return h($path);
          }
          if (strpos($path, '://') !== false || preg_match('/^[a-z]+:/i', $path)) {
              return ltrim($this->build($path), '/');
          }
          if (!array_key_exists('plugin', $options) || $options['plugin'] !== false) {
              list($plugin, $path) = $this->_View->pluginSplit($path, false);
          }
          if (!empty($options['pathPrefix']) && $path[0] !== '/') {
              $path = $options['pathPrefix'] . $path;
          }
          if (!empty($options['ext']) &&
              strpos($path, '?') === false &&
              substr($path, -strlen($options['ext'])) !== $options['ext']
          ) {
              $path .= $options['ext'];
          }
          if (preg_match('|^([a-z0-9]+:)?//|', $path)) {
              return $this->build($path);
          }
          if (isset($plugin)) {
              $path = Inflector::underscore($plugin) . '/' . $path;
          }
  
          $optionTimestamp = null;
          if (array_key_exists('timestamp', $options)) {
              $optionTimestamp = $options['timestamp'];
          }
          $webPath = $this->assetTimestamp($this->webroot($path), $optionTimestamp);
  
          $path = $this->_encodeUrl($webPath);
  
          if (!empty($options['fullBase'])) {
              $fullBaseUrl = is_string($options['fullBase']) ? $options['fullBase'] : Router::fullBaseUrl();
              $path = rtrim($fullBaseUrl, '/') . '/' . ltrim($path, '/');
          }
  
          return $path;
      }
code_tokens: public function assetUrl ( $ path , array $ options = [ ] ) { if ( is_array ( $ path ) ) { return $ this -> build ( $ path , ! empty ( $ options [ 'fullBase' ] ) ) ; } // data URIs only require HTML escaping if ( preg_match ( '/^data:[a-z]+\/[a-z]+;/' , $ path ) ) { return h ( $ path ) ; } if ( strpos ( $ path , '://' ) !== false || preg_match ( '/^[a-z]+:/i' , $ path ) ) { return ltrim ( $ this -> build ( $ path ) , '/' ) ; } if ( ! array_key_exists ( 'plugin' , $ options ) || $ options [ 'plugin' ] !== false ) { list ( $ plugin , $ path ) = $ this -> _View -> pluginSplit ( $ path , false ) ; } if ( ! empty ( $ options [ 'pathPrefix' ] ) && $ path [ 0 ] !== '/' ) { $ path = $ options [ 'pathPrefix' ] . $ path ; } if ( ! empty ( $ options [ 'ext' ] ) && strpos ( $ path , '?' ) === false && substr ( $ path , - strlen ( $ options [ 'ext' ] ) ) !== $ options [ 'ext' ] ) { $ path .= $ options [ 'ext' ] ; } if ( preg_match ( '|^([a-z0-9]+:)?//|' , $ path ) ) { return $ this -> build ( $ path ) ; } if ( isset ( $ plugin ) ) { $ path = Inflector :: underscore ( $ plugin ) . '/' . $ path ; } $ optionTimestamp = null ; if ( array_key_exists ( 'timestamp' , $ options ) ) { $ optionTimestamp = $ options [ 'timestamp' ] ; } $ webPath = $ this -> assetTimestamp ( $ this -> webroot ( $ path ) , $ optionTimestamp ) ; $ path = $ this -> _encodeUrl ( $ webPath ) ; if ( ! empty ( $ options [ 'fullBase' ] ) ) { $ fullBaseUrl = is_string ( $ options [ 'fullBase' ] ) ? $ options [ 'fullBase' ] : Router :: fullBaseUrl ( ) ; $ path = rtrim ( $ fullBaseUrl , '/' ) . '/' . ltrim ( $ path , '/' ) ; } return $ path ; }
docstring: Generates URL for given asset file.
  
  Depending on options passed provides full URL with domain name. Also calls
  `Helper::assetTimestamp()` to add timestamp to local files.
  
  ### Options:
  
  - `fullBase` Boolean true or a string (e.g. https://example) to
  return full URL with protocol and domain name.
  - `pathPrefix` Path prefix for relative URLs
  - `ext` Asset extension to append
  - `plugin` False value will prevent parsing path as a plugin
  - `timestamp` Overrides the value of `Asset.timestamp` in Configure.
  Set to false to skip timestamp generation.
  Set to true to apply timestamps when debug is true. Set to 'force' to always
  enable timestamping regardless of debug value.
  
  @param string|array $path Path string or URL array
  @param array $options Options array.
  @return string Generated URL
docstring_tokens: Generates URL for given asset file .