original_string: protected function maybeCompressJsCode($js)
      {
          if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
              $time = microtime(true);
          }
          $js = (string) $js; // Force string value.
  
          if (isset($this->options['compress_js_code'])) {
              if (!$this->options['compress_js_code']) {
                  $disabled = true; // Disabled flag.
              }
          }
          if (!$js || !empty($disabled)) {
              goto finale; // Nothing to do.
          }
          if (strlen($js) > 1000000) {
              // Exclude VERY large files. Too time-consuming.
              // Should really be compressed ahead-of-time anyway.
              goto finale; // Don't compress HUGE files.
          }
          try { // Catch JS compression-related exceptions.
              if (!($compressed_js = \WebSharks\JsMinifier\Core::compress($js))) {
                  // `E_USER_NOTICE` to avoid a show-stopping problem.
                  trigger_error('JS compression failure.', E_USER_NOTICE);
              } else {
                  $js = $compressed_js;
              } // Use compressed JS file.
          } catch (\Exception $exception) {
              trigger_error($exception->getMessage(), E_USER_NOTICE);
          }
          finale: // Target point; finale/return value.
  
          if ($js) {
              $js = trim($js);
          }
          if ($benchmark && !empty($time) && $js && empty($disabled)) {
              $this->benchmark->addTime(
                  __FUNCTION__,
                  $time, // Caller, start time, task performed.
                  sprintf('compressing JS w/ checksum: `%1$s`', md5($js))
              );
          }
          return $js;
      }
code: protected function maybeCompressJsCode($js)
      {
          if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
              $time = microtime(true);
          }
          $js = (string) $js; // Force string value.
  
          if (isset($this->options['compress_js_code'])) {
              if (!$this->options['compress_js_code']) {
                  $disabled = true; // Disabled flag.
              }
          }
          if (!$js || !empty($disabled)) {
              goto finale; // Nothing to do.
          }
          if (strlen($js) > 1000000) {
              // Exclude VERY large files. Too time-consuming.
              // Should really be compressed ahead-of-time anyway.
              goto finale; // Don't compress HUGE files.
          }
          try { // Catch JS compression-related exceptions.
              if (!($compressed_js = \WebSharks\JsMinifier\Core::compress($js))) {
                  // `E_USER_NOTICE` to avoid a show-stopping problem.
                  trigger_error('JS compression failure.', E_USER_NOTICE);
              } else {
                  $js = $compressed_js;
              } // Use compressed JS file.
          } catch (\Exception $exception) {
              trigger_error($exception->getMessage(), E_USER_NOTICE);
          }
          finale: // Target point; finale/return value.
  
          if ($js) {
              $js = trim($js);
          }
          if ($benchmark && !empty($time) && $js && empty($disabled)) {
              $this->benchmark->addTime(
                  __FUNCTION__,
                  $time, // Caller, start time, task performed.
                  sprintf('compressing JS w/ checksum: `%1$s`', md5($js))
              );
          }
          return $js;
      }
code_tokens: protected function maybeCompressJsCode ( $ js ) { if ( ( $ benchmark = ! empty ( $ this -> options [ 'benchmark' ] ) && $ this -> options [ 'benchmark' ] === 'details' ) ) { $ time = microtime ( true ) ; } $ js = ( string ) $ js ; // Force string value. if ( isset ( $ this -> options [ 'compress_js_code' ] ) ) { if ( ! $ this -> options [ 'compress_js_code' ] ) { $ disabled = true ; // Disabled flag. } } if ( ! $ js || ! empty ( $ disabled ) ) { goto finale ; // Nothing to do. } if ( strlen ( $ js ) > 1000000 ) { // Exclude VERY large files. Too time-consuming. // Should really be compressed ahead-of-time anyway. goto finale ; // Don't compress HUGE files. } try { // Catch JS compression-related exceptions. if ( ! ( $ compressed_js = \ WebSharks \ JsMinifier \ Core :: compress ( $ js ) ) ) { // `E_USER_NOTICE` to avoid a show-stopping problem. trigger_error ( 'JS compression failure.' , E_USER_NOTICE ) ; } else { $ js = $ compressed_js ; } // Use compressed JS file. } catch ( \ Exception $ exception ) { trigger_error ( $ exception -> getMessage ( ) , E_USER_NOTICE ) ; } finale : // Target point; finale/return value. if ( $ js ) { $ js = trim ( $ js ) ; } if ( $ benchmark && ! empty ( $ time ) && $ js && empty ( $ disabled ) ) { $ this -> benchmark -> addTime ( __FUNCTION__ , $ time , // Caller, start time, task performed. sprintf ( 'compressing JS w/ checksum: `%1$s`' , md5 ( $ js ) ) ) ; } return $ js ; }
docstring: Maybe compress JS code.
  
  @since 140417 Initial release.
  
  @param string $js Raw JS code.
  
  @return string JS code (possibly compressed).
docstring_tokens: Maybe compress JS code .