Skip to content

Commit

Permalink
Add docblocks, shorten lines
Browse files Browse the repository at this point in the history
  • Loading branch information
jadb committed Feb 27, 2016
1 parent 1fc3807 commit 193f35b
Showing 1 changed file with 44 additions and 3 deletions.
47 changes: 44 additions & 3 deletions src/View/Helper/UrlHelper.php
Expand Up @@ -40,19 +40,60 @@ public function build($url = null, $full = false)
return h(Router::url($url, $full)); 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 = []) 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 = []) 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 = []) 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'));
} }


/** /**
Expand Down

0 comments on commit 193f35b

Please sign in to comment.