original_string: protected function maybeCompressCombineHeadJs($html)
      {
          if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
              $time = microtime(true);
          }
          $html = (string) $html; // Force string value.
  
          if (isset($this->options['compress_combine_head_js'])) {
              if (!$this->options['compress_combine_head_js']) {
                  $disabled = true; // Disabled flag.
              }
          }
          if (!$html || !empty($disabled)) {
              goto finale; // Nothing to do.
          }
          if (($head_frag = $this->getHeadFrag($html)) /* No need to get the HTML frag here; we're operating on the `<head>` only. */) {
              if (($js_tag_frags = $this->getJsTagFrags($head_frag)) && ($js_parts = $this->compileJsTagFragsIntoParts($js_tag_frags, 'head'))) {
                  $js_tag_frags_all_compiled = $this->compileKeyElementsDeep($js_tag_frags, 'all');
                  $html                      = $this->replaceOnce($head_frag['all'], '%%htmlc-head%%', $html);
                  $cleaned_head_contents     = $this->replaceOnce($js_tag_frags_all_compiled, '', $head_frag['contents']);
                  $cleaned_head_contents     = $this->cleanupSelfClosingHtmlTagLines($cleaned_head_contents);
  
                  $compressed_js_tags = []; // Initialize.
  
                  foreach ($js_parts as $_js_part) {
                      if (isset($_js_part['exclude_frag'], $js_tag_frags[$_js_part['exclude_frag']]['all'])) {
                          $compressed_js_tags[] = $js_tag_frags[$_js_part['exclude_frag']]['all'];
                      } else {
                          $compressed_js_tags[] = $_js_part['tag'];
                      }
                  } // unset($_js_part); // Housekeeping.
  
                  $compressed_js_tags    = implode("\n", $compressed_js_tags);
                  $compressed_head_parts = [$head_frag['open_tag'], $cleaned_head_contents, $compressed_js_tags, $head_frag['closing_tag']];
                  $html                  = $this->replaceOnce('%%htmlc-head%%', implode("\n", $compressed_head_parts), $html);
  
                  if ($benchmark) {
                      $this->benchmark->addData(
                          __FUNCTION__,
                          compact(
                              'head_frag',
                              'js_tag_frags',
                              'js_parts',
                              'cleaned_head_contents',
                              'compressed_js_tags',
                              'compressed_head_parts'
                          )
                      );
                  }
              }
          }
          finale: // Target point; finale/return value.
  
          if ($html) {
              $html = trim($html);
          } // Trim it up now!
  
          if ($benchmark && !empty($time) && $html && empty($disabled)) {
              $this->benchmark->addTime(
                  __FUNCTION__,
                  $time, // Caller, start time, task performed.
                  sprintf('compressing/combining head JS in checksum: `%1$s`', md5($html))
              );
          }
          return $html; // With possible compression having been applied here.
      }
code: protected function maybeCompressCombineHeadJs($html)
      {
          if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
              $time = microtime(true);
          }
          $html = (string) $html; // Force string value.
  
          if (isset($this->options['compress_combine_head_js'])) {
              if (!$this->options['compress_combine_head_js']) {
                  $disabled = true; // Disabled flag.
              }
          }
          if (!$html || !empty($disabled)) {
              goto finale; // Nothing to do.
          }
          if (($head_frag = $this->getHeadFrag($html)) /* No need to get the HTML frag here; we're operating on the `<head>` only. */) {
              if (($js_tag_frags = $this->getJsTagFrags($head_frag)) && ($js_parts = $this->compileJsTagFragsIntoParts($js_tag_frags, 'head'))) {
                  $js_tag_frags_all_compiled = $this->compileKeyElementsDeep($js_tag_frags, 'all');
                  $html                      = $this->replaceOnce($head_frag['all'], '%%htmlc-head%%', $html);
                  $cleaned_head_contents     = $this->replaceOnce($js_tag_frags_all_compiled, '', $head_frag['contents']);
                  $cleaned_head_contents     = $this->cleanupSelfClosingHtmlTagLines($cleaned_head_contents);
  
                  $compressed_js_tags = []; // Initialize.
  
                  foreach ($js_parts as $_js_part) {
                      if (isset($_js_part['exclude_frag'], $js_tag_frags[$_js_part['exclude_frag']]['all'])) {
                          $compressed_js_tags[] = $js_tag_frags[$_js_part['exclude_frag']]['all'];
                      } else {
                          $compressed_js_tags[] = $_js_part['tag'];
                      }
                  } // unset($_js_part); // Housekeeping.
  
                  $compressed_js_tags    = implode("\n", $compressed_js_tags);
                  $compressed_head_parts = [$head_frag['open_tag'], $cleaned_head_contents, $compressed_js_tags, $head_frag['closing_tag']];
                  $html                  = $this->replaceOnce('%%htmlc-head%%', implode("\n", $compressed_head_parts), $html);
  
                  if ($benchmark) {
                      $this->benchmark->addData(
                          __FUNCTION__,
                          compact(
                              'head_frag',
                              'js_tag_frags',
                              'js_parts',
                              'cleaned_head_contents',
                              'compressed_js_tags',
                              'compressed_head_parts'
                          )
                      );
                  }
              }
          }
          finale: // Target point; finale/return value.
  
          if ($html) {
              $html = trim($html);
          } // Trim it up now!
  
          if ($benchmark && !empty($time) && $html && empty($disabled)) {
              $this->benchmark->addTime(
                  __FUNCTION__,
                  $time, // Caller, start time, task performed.
                  sprintf('compressing/combining head JS in checksum: `%1$s`', md5($html))
              );
          }
          return $html; // With possible compression having been applied here.
      }
code_tokens: protected function maybeCompressCombineHeadJs ( $ html ) { if ( ( $ benchmark = ! empty ( $ this -> options [ 'benchmark' ] ) && $ this -> options [ 'benchmark' ] === 'details' ) ) { $ time = microtime ( true ) ; } $ html = ( string ) $ html ; // Force string value. if ( isset ( $ this -> options [ 'compress_combine_head_js' ] ) ) { if ( ! $ this -> options [ 'compress_combine_head_js' ] ) { $ disabled = true ; // Disabled flag. } } if ( ! $ html || ! empty ( $ disabled ) ) { goto finale ; // Nothing to do. } if ( ( $ head_frag = $ this -> getHeadFrag ( $ html ) ) /* No need to get the HTML frag here; we're operating on the `<head>` only. */ ) { if ( ( $ js_tag_frags = $ this -> getJsTagFrags ( $ head_frag ) ) && ( $ js_parts = $ this -> compileJsTagFragsIntoParts ( $ js_tag_frags , 'head' ) ) ) { $ js_tag_frags_all_compiled = $ this -> compileKeyElementsDeep ( $ js_tag_frags , 'all' ) ; $ html = $ this -> replaceOnce ( $ head_frag [ 'all' ] , '%%htmlc-head%%' , $ html ) ; $ cleaned_head_contents = $ this -> replaceOnce ( $ js_tag_frags_all_compiled , '' , $ head_frag [ 'contents' ] ) ; $ cleaned_head_contents = $ this -> cleanupSelfClosingHtmlTagLines ( $ cleaned_head_contents ) ; $ compressed_js_tags = [ ] ; // Initialize. foreach ( $ js_parts as $ _js_part ) { if ( isset ( $ _js_part [ 'exclude_frag' ] , $ js_tag_frags [ $ _js_part [ 'exclude_frag' ] ] [ 'all' ] ) ) { $ compressed_js_tags [ ] = $ js_tag_frags [ $ _js_part [ 'exclude_frag' ] ] [ 'all' ] ; } else { $ compressed_js_tags [ ] = $ _js_part [ 'tag' ] ; } } // unset($_js_part); // Housekeeping. $ compressed_js_tags = implode ( "\n" , $ compressed_js_tags ) ; $ compressed_head_parts = [ $ head_frag [ 'open_tag' ] , $ cleaned_head_contents , $ compressed_js_tags , $ head_frag [ 'closing_tag' ] ] ; $ html = $ this -> replaceOnce ( '%%htmlc-head%%' , implode ( "\n" , $ compressed_head_parts ) , $ html ) ; if ( $ benchmark ) { $ this -> benchmark -> addData ( __FUNCTION__ , compact ( 'head_frag' , 'js_tag_frags' , 'js_parts' , 'cleaned_head_contents' , 'compressed_js_tags' , 'compressed_head_parts' ) ) ; } } } finale : // Target point; finale/return value. if ( $ html ) { $ html = trim ( $ html ) ; } // Trim it up now! if ( $ benchmark && ! empty ( $ time ) && $ html && empty ( $ disabled ) ) { $ this -> benchmark -> addTime ( __FUNCTION__ , $ time , // Caller, start time, task performed. sprintf ( 'compressing/combining head JS in checksum: `%1$s`' , md5 ( $ html ) ) ) ; } return $ html ; // With possible compression having been applied here. }
docstring: Handles possible compression of head JS.
  
  @since 140417 Initial release.
  
  @param string $html Input HTML code.
  
  @return string HTML code, after possible JS compression.
docstring_tokens: Handles possible compression of head JS .