ComposerInstallersShopwareInstaller

Plugin/theme installer for shopware.

Defined (1)

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

/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php  
  1. class ShopwareInstaller extends BaseInstaller 
  2. protected $locations = array( 
  3. 'backend-plugin' => 'engine/Shopware/Plugins/Local/Backend/{$name}/',  
  4. 'core-plugin' => 'engine/Shopware/Plugins/Local/Core/{$name}/',  
  5. 'frontend-plugin' => 'engine/Shopware/Plugins/Local/Frontend/{$name}/',  
  6. 'theme' => 'templates/{$name}/' 
  7. ); 
  8.  
  9. /** 
  10. * Transforms the names 
  11. * @param array $vars 
  12. * @return array 
  13. */ 
  14. public function inflectPackageVars($vars) 
  15. if ($vars['type'] === 'shopware-theme') { 
  16. return $this->correctThemeName($vars); 
  17. } else { 
  18. return $this->correctPluginName($vars); 
  19.  
  20. /** 
  21. * Changes the name to a camelcased combination of vendor and name 
  22. * @param array $vars 
  23. * @return array 
  24. */ 
  25. private function correctPluginName($vars) 
  26. $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) { 
  27. return strtoupper($matches[0][1]); 
  28. }, $vars['name']); 
  29.  
  30. $vars['name'] = ucfirst($vars['vendor']) . ucfirst($camelCasedName); 
  31.  
  32. return $vars; 
  33.  
  34. /** 
  35. * Changes the name to a underscore separated name 
  36. * @param array $vars 
  37. * @return array 
  38. */ 
  39. private function correctThemeName($vars) 
  40. $vars['name'] = str_replace('-', '_', $vars['name']); 
  41.  
  42. return $vars;