original_string: public function Link()
      {
          $link = '';
          switch ($this->type) {
              case 'Internal' :
                  if ($this->internal && ($page = SiteTree::get()->byID($this->internal))) {
                      $link = $page->Link();
                  }
                  break;
              case 'External' :
                  $link = $this->external;
                  break;
              case 'Email' :
                  $link = $this->email ? 'mailto:' . $this->email : '';
                  break;
              case 'File' :
                  if ($this->file) {
                      $link = File::get()->byID($this->file)->Filename;
                  }
                  break;
              case 'DataObject':
                  if ($do = $this->getDO()) {
                      $link = $do->Link();
                  }
                  break;
          }
  
          if ($this->extra) {
              //added a query string, but no ? to start it
              if (strpos($this->extra, '=' !== false && strpos($this->extra, '?' === false))) {
                  $link .= '?';
              }
  
              $link .= $this->extra;
          }
  
          if ($this->anchor) {
              $link .= '#' . $this->anchor;
          }
  
          return $link;
      }
code: public function Link()
      {
          $link = '';
          switch ($this->type) {
              case 'Internal' :
                  if ($this->internal && ($page = SiteTree::get()->byID($this->internal))) {
                      $link = $page->Link();
                  }
                  break;
              case 'External' :
                  $link = $this->external;
                  break;
              case 'Email' :
                  $link = $this->email ? 'mailto:' . $this->email : '';
                  break;
              case 'File' :
                  if ($this->file) {
                      $link = File::get()->byID($this->file)->Filename;
                  }
                  break;
              case 'DataObject':
                  if ($do = $this->getDO()) {
                      $link = $do->Link();
                  }
                  break;
          }
  
          if ($this->extra) {
              //added a query string, but no ? to start it
              if (strpos($this->extra, '=' !== false && strpos($this->extra, '?' === false))) {
                  $link .= '?';
              }
  
              $link .= $this->extra;
          }
  
          if ($this->anchor) {
              $link .= '#' . $this->anchor;
          }
  
          return $link;
      }
code_tokens: public function Link ( ) { $ link = '' ; switch ( $ this -> type ) { case 'Internal' : if ( $ this -> internal && ( $ page = SiteTree :: get ( ) -> byID ( $ this -> internal ) ) ) { $ link = $ page -> Link ( ) ; } break ; case 'External' : $ link = $ this -> external ; break ; case 'Email' : $ link = $ this -> email ? 'mailto:' . $ this -> email : '' ; break ; case 'File' : if ( $ this -> file ) { $ link = File :: get ( ) -> byID ( $ this -> file ) -> Filename ; } break ; case 'DataObject' : if ( $ do = $ this -> getDO ( ) ) { $ link = $ do -> Link ( ) ; } break ; } if ( $ this -> extra ) { //added a query string, but no ? to start it if ( strpos ( $ this -> extra , '=' !== false && strpos ( $ this -> extra , '?' === false ) ) ) { $ link .= '?' ; } $ link .= $ this -> extra ; } if ( $ this -> anchor ) { $ link .= '#' . $ this -> anchor ; } return $ link ; }
docstring: Determines the link by the type and what is set
  
  @return mixed|string
docstring_tokens: Determines the link by the type and what is set