Skip to content
Permalink
Browse files

Add docblocks, shorten lines

  • Loading branch information...
jadb committed Feb 27, 2016
1 parent 1fc3807 commit 193f35b3f243b9444a789dc9835c56a4025bdc26
Showing with 44 additions and 3 deletions.
  1. +44 −3 src/View/Helper/UrlHelper.php
@@ -40,19 +40,60 @@ public function build($url = null, $full = false)
return h(Router::url($url, $full));
}
/**
* Generate URL for given image file. Depending on options passed provides full URL
* with domain name. Also calls Helper::assetTimestamp() to add timestamp to local files
*
* @param string|array $path Path string or URL array
* @param array $options Options array. Possible keys:
* `fullBase` Return full URL with domain name
* `pathPrefix` Path prefix for relative URLs
* `ext` Asset extension to append
* `plugin` False value will prevent parsing path as a plugin
* @return string Generated URL
*/
public function imageUrl($path, array $options = [])
{
return $this->assetUrl($path, $options + ['pathPrefix' => Configure::read('App.imageBaseUrl')]);
$pathPrefix = Configure::read('App.imageBaseUrl');
return $this->assetUrl($path, $options + compact('pathPrefix'));
}
/**
* Generate URL for given CSS file. Depending on options passed provides full URL
* with domain name. Also calls Helper::assetTimestamp() to add timestamp to local files
*
* @param string|array $path Path string or URL array
* @param array $options Options array. Possible keys:
* `fullBase` Return full URL with domain name
* `pathPrefix` Path prefix for relative URLs
* `ext` Asset extension to append
* `plugin` False value will prevent parsing path as a plugin
* @return string Generated URL
*/
public function cssUrl($path, array $options = [])
{
return $this->assetUrl($path, $options + ['pathPrefix' => Configure::read('App.cssBaseUrl'), 'ext' => '.css']);
$pathPrefix = Configure::read('App.cssBaseUrl');
$ext = '.css';
return $this->assetUrl($path, $options + compact('pathPrefix', 'ext'));
}
/**
* Generate URL for given javascript file. Depending on options passed provides full
* URL with domain name. Also calls Helper::assetTimestamp() to add timestamp to local files
*
* @param string|array $path Path string or URL array
* @param array $options Options array. Possible keys:
* `fullBase` Return full URL with domain name
* `pathPrefix` Path prefix for relative URLs
* `ext` Asset extension to append
* `plugin` False value will prevent parsing path as a plugin
* @return string Generated URL
*/
public function scriptUrl($path, array $options = [])
{
return $this->assetUrl($url, $options + ['pathPrefix' => Configure::read('App.jsBaseUrl'), 'ext' => '.js']);
$pathPrefix = Configure::read('App.jsBaseUrl');
$ext = '.js';
return $this->assetUrl($path, $options + compact('pathPrefix', 'ext'));
}
/**

0 comments on commit 193f35b

Please sign in to comment.
You can’t perform that action at this time.