xrstfComposer52Generator

The WooCommerce Naguro Connect xrstf Composer52 Generator class.

Defined (1)

The class is defined in the following location(s).

/vendor/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php  
  1. class Generator { 
  2. public static function onPostInstallCmd(Event $event) { 
  3. $composer = $event->getComposer(); 
  4. $installationManager = $composer->getInstallationManager(); 
  5. $repoManager = $composer->getRepositoryManager(); 
  6. $localRepo = $repoManager->getLocalRepository(); 
  7. $package = $composer->getPackage(); 
  8. $config = $composer->getConfig(); 
  9.  
  10. // We can't gain access to the Command's input object, so we have to look 
  11. // for -o / --optimize-autoloader ourselves. Sadly, neither getopt() works 
  12. // (always returns an empty array), nor does Symfony's Console Input, as 
  13. // it expects a full definition of the current command line and we can't 
  14. // provide that. 
  15.  
  16. // $def = new InputDefinition(array(new InputOption('optimize', 'o', InputOption::VALUE_NONE))); 
  17. // $input = new ArgvInput(null, $def); 
  18. // var_dump($input->hasOption('o')); // "Too many arguments" 
  19.  
  20. // $options = getopt('o', array('optimize-autoloader')); // always array() 
  21. // $optimize = !empty($options); 
  22.  
  23. $args = $_SERVER['argv']; 
  24. $optimize = in_array('-o', $args) || in_array('-o', $args); 
  25.  
  26. $generator = new AutoloadGenerator(); 
  27. $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);