Development

Changeset 22271

You must first sign up to be able to contribute.

Changeset 22271

Show
Ignore:
Timestamp:
09/23/09 08:42:26 (4 years ago)
Author:
fabien
Message:

[templating] made a small optimization (closes #7182)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • components/templating/trunk/lib/sfTemplateHelperAssets.php

    r22269 r22271  
    9393   * Gets the base URL. 
    9494   * 
     95   * @param  string $path The path 
     96   * 
    9597   * @return string The base URL 
    9698   */ 
    9799  public function getBaseURL($path) 
    98100  { 
    99     if (!$this->baseURLs) 
     101    $count = count($this->baseURLs); 
     102 
     103    if (0 === $count) 
    100104    { 
    101105      return ''; 
    102106    } 
    103     elseif (1 == count($this->baseURLs)) 
     107 
     108    if (1 === $count) 
    104109    { 
    105110      return $this->baseURLs[0]; 
    106111    } 
    107     else 
    108     { 
    109       return $this->baseURLs[fmod(hexdec(substr(md5($path), 0, 10)), count($this->baseURLs))]; 
    110     } 
     112 
     113    return $this->baseURLs[fmod(hexdec(substr(md5($path), 0, 10)), $count)]; 
     114 
    111115  } 
    112116