original_string: public function compile($outputfile)
      {
          if (empty($this->index)) {
              throw new \LogicException('Cannot compile when no index files are defined.');
          }
  
          if (file_exists($outputfile)) {
              unlink($outputfile);
          }
  
          $name = basename($outputfile);
          $phar = new \Phar($outputfile, 0, $name);
          $phar->setSignatureAlgorithm(\Phar::SHA1);
          $phar->startBuffering();
  
          foreach ($this->files as $virtualfile => $fileinfo) {
              list($realfile, $strip) = $fileinfo;
              $content = file_get_contents($realfile);
  
              if ($strip) {
                  $content = $this->stripWhitespace($content);
              }
  
              $phar->addFromString($virtualfile, $content);
          }
  
          foreach ($this->index as $type => $fileinfo) {
              list($virtualfile, $realfile) = $fileinfo;
              $content = file_get_contents($realfile);
  
              if ($type == 'cli') {
                  $content = preg_replace('{^#!/usr/bin/env php\s*}', '', $content);
              }
  
              $phar->addFromString($virtualfile, $content);
          }
  
          $stub = $this->generateStub($name);
          $phar->setStub($stub);
  
          $phar->stopBuffering();
          unset($phar);
      }
code: public function compile($outputfile)
      {
          if (empty($this->index)) {
              throw new \LogicException('Cannot compile when no index files are defined.');
          }
  
          if (file_exists($outputfile)) {
              unlink($outputfile);
          }
  
          $name = basename($outputfile);
          $phar = new \Phar($outputfile, 0, $name);
          $phar->setSignatureAlgorithm(\Phar::SHA1);
          $phar->startBuffering();
  
          foreach ($this->files as $virtualfile => $fileinfo) {
              list($realfile, $strip) = $fileinfo;
              $content = file_get_contents($realfile);
  
              if ($strip) {
                  $content = $this->stripWhitespace($content);
              }
  
              $phar->addFromString($virtualfile, $content);
          }
  
          foreach ($this->index as $type => $fileinfo) {
              list($virtualfile, $realfile) = $fileinfo;
              $content = file_get_contents($realfile);
  
              if ($type == 'cli') {
                  $content = preg_replace('{^#!/usr/bin/env php\s*}', '', $content);
              }
  
              $phar->addFromString($virtualfile, $content);
          }
  
          $stub = $this->generateStub($name);
          $phar->setStub($stub);
  
          $phar->stopBuffering();
          unset($phar);
      }
code_tokens: public function compile ( $ outputfile ) { if ( empty ( $ this -> index ) ) { throw new \ LogicException ( 'Cannot compile when no index files are defined.' ) ; } if ( file_exists ( $ outputfile ) ) { unlink ( $ outputfile ) ; } $ name = basename ( $ outputfile ) ; $ phar = new \ Phar ( $ outputfile , 0 , $ name ) ; $ phar -> setSignatureAlgorithm ( \ Phar :: SHA1 ) ; $ phar -> startBuffering ( ) ; foreach ( $ this -> files as $ virtualfile => $ fileinfo ) { list ( $ realfile , $ strip ) = $ fileinfo ; $ content = file_get_contents ( $ realfile ) ; if ( $ strip ) { $ content = $ this -> stripWhitespace ( $ content ) ; } $ phar -> addFromString ( $ virtualfile , $ content ) ; } foreach ( $ this -> index as $ type => $ fileinfo ) { list ( $ virtualfile , $ realfile ) = $ fileinfo ; $ content = file_get_contents ( $ realfile ) ; if ( $ type == 'cli' ) { $ content = preg_replace ( '{^#!/usr/bin/env php\s*}' , '' , $ content ) ; } $ phar -> addFromString ( $ virtualfile , $ content ) ; } $ stub = $ this -> generateStub ( $ name ) ; $ phar -> setStub ( $ stub ) ; $ phar -> stopBuffering ( ) ; unset ( $ phar ) ; }
docstring: Compiles all files into a single PHAR file.
  
  @param string $outputfile The full name of the file to create
  @throws \LogicException if no index files are defined.
docstring_tokens: Compiles all files into a single PHAR file .