original_string: public function canonicalUrl($url)
      {
          if (strlen($url)) {
              if ($url[0] == '/') {
                  // If the URL begins with a "/", the following is the
                  // canonical URL
                  return substr($url, 1);
              } else {
                  // Else, the canonical name is under the current dir
                  if ($this->getDirName()) {
                      return $this->canonicalize($this->getDirName() . '/' .$url);
                  } else {
                      return $this->canonicalize($url);
                  }
              }
          }
  
          return null;
      }
code: public function canonicalUrl($url)
      {
          if (strlen($url)) {
              if ($url[0] == '/') {
                  // If the URL begins with a "/", the following is the
                  // canonical URL
                  return substr($url, 1);
              } else {
                  // Else, the canonical name is under the current dir
                  if ($this->getDirName()) {
                      return $this->canonicalize($this->getDirName() . '/' .$url);
                  } else {
                      return $this->canonicalize($url);
                  }
              }
          }
  
          return null;
      }
code_tokens: public function canonicalUrl ( $ url ) { if ( strlen ( $ url ) ) { if ( $ url [ 0 ] == '/' ) { // If the URL begins with a "/", the following is the // canonical URL return substr ( $ url , 1 ) ; } else { // Else, the canonical name is under the current dir if ( $ this -> getDirName ( ) ) { return $ this -> canonicalize ( $ this -> getDirName ( ) . '/' . $ url ) ; } else { return $ this -> canonicalize ( $ url ) ; } } } return null ; }
docstring: Gets a canonical URL from the given one
docstring_tokens: Gets a canonical URL from the given one