original_string: protected function gatherLinks(array $assets, $css = true)
      {
          $buffer = '';
  
  
          foreach ($assets as $id => $asset) {
              $local = true;
  
              $link = $asset->getAsset();
              $relative_path = $link;
  
              if (static::isRemoteLink($link)) {
                  $local = false;
                  if (0 === strpos($link, '//')) {
                      $link = 'http:' . $link;
                  }
                  $relative_dir = \dirname($relative_path);
              } else {
                  // Fix to remove relative dir if grav is in one
                  if (($this->base_url !== '/') && Utils::startsWith($relative_path, $this->base_url)) {
                      $base_url = '#' . preg_quote($this->base_url, '#') . '#';
                      $relative_path = ltrim(preg_replace($base_url, '/', $link, 1), '/');
                  }
  
                  $relative_dir = \dirname($relative_path);
                  $link = ROOT_DIR . $relative_path;
              }
  
              $file = ($this->fetch_command instanceof \Closure) ? @$this->fetch_command->__invoke($link) : @file_get_contents($link);
  
              // No file found, skip it...
              if ($file === false) {
                  continue;
              }
  
              // Double check last character being
              if (!$css) {
                  $file = rtrim($file, ' ;') . ';';
              }
  
              // If this is CSS + the file is local + rewrite enabled
              if ($css && $this->css_rewrite) {
                  $file = $this->cssRewrite($file, $relative_dir, $local);
              }
  
              $file = rtrim($file) . PHP_EOL;
              $buffer .= $file;
          }
  
          // Pull out @imports and move to top
          if ($css) {
              $buffer = $this->moveImports($buffer);
          }
  
          return $buffer;
      }
code: protected function gatherLinks(array $assets, $css = true)
      {
          $buffer = '';
  
  
          foreach ($assets as $id => $asset) {
              $local = true;
  
              $link = $asset->getAsset();
              $relative_path = $link;
  
              if (static::isRemoteLink($link)) {
                  $local = false;
                  if (0 === strpos($link, '//')) {
                      $link = 'http:' . $link;
                  }
                  $relative_dir = \dirname($relative_path);
              } else {
                  // Fix to remove relative dir if grav is in one
                  if (($this->base_url !== '/') && Utils::startsWith($relative_path, $this->base_url)) {
                      $base_url = '#' . preg_quote($this->base_url, '#') . '#';
                      $relative_path = ltrim(preg_replace($base_url, '/', $link, 1), '/');
                  }
  
                  $relative_dir = \dirname($relative_path);
                  $link = ROOT_DIR . $relative_path;
              }
  
              $file = ($this->fetch_command instanceof \Closure) ? @$this->fetch_command->__invoke($link) : @file_get_contents($link);
  
              // No file found, skip it...
              if ($file === false) {
                  continue;
              }
  
              // Double check last character being
              if (!$css) {
                  $file = rtrim($file, ' ;') . ';';
              }
  
              // If this is CSS + the file is local + rewrite enabled
              if ($css && $this->css_rewrite) {
                  $file = $this->cssRewrite($file, $relative_dir, $local);
              }
  
              $file = rtrim($file) . PHP_EOL;
              $buffer .= $file;
          }
  
          // Pull out @imports and move to top
          if ($css) {
              $buffer = $this->moveImports($buffer);
          }
  
          return $buffer;
      }
code_tokens: protected function gatherLinks ( array $ assets , $ css = true ) { $ buffer = '' ; foreach ( $ assets as $ id => $ asset ) { $ local = true ; $ link = $ asset -> getAsset ( ) ; $ relative_path = $ link ; if ( static :: isRemoteLink ( $ link ) ) { $ local = false ; if ( 0 === strpos ( $ link , '//' ) ) { $ link = 'http:' . $ link ; } $ relative_dir = \ dirname ( $ relative_path ) ; } else { // Fix to remove relative dir if grav is in one if ( ( $ this -> base_url !== '/' ) && Utils :: startsWith ( $ relative_path , $ this -> base_url ) ) { $ base_url = '#' . preg_quote ( $ this -> base_url , '#' ) . '#' ; $ relative_path = ltrim ( preg_replace ( $ base_url , '/' , $ link , 1 ) , '/' ) ; } $ relative_dir = \ dirname ( $ relative_path ) ; $ link = ROOT_DIR . $ relative_path ; } $ file = ( $ this -> fetch_command instanceof \ Closure ) ? @ $ this -> fetch_command -> __invoke ( $ link ) : @ file_get_contents ( $ link ) ; // No file found, skip it... if ( $ file === false ) { continue ; } // Double check last character being if ( ! $ css ) { $ file = rtrim ( $ file , ' ;' ) . ';' ; } // If this is CSS + the file is local + rewrite enabled if ( $ css && $ this -> css_rewrite ) { $ file = $ this -> cssRewrite ( $ file , $ relative_dir , $ local ) ; } $ file = rtrim ( $ file ) . PHP_EOL ; $ buffer .= $ file ; } // Pull out @imports and move to top if ( $ css ) { $ buffer = $ this -> moveImports ( $ buffer ) ; } return $ buffer ; }
docstring: Download and concatenate the content of several links.
  
  @param  array $assets
  @param  bool $css
  
  @return string
docstring_tokens: Download and concatenate the content of several links .