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. 'plugin' => 'custom/plugins/{$name}/',  
  8. 'frontend-theme' => 'themes/Frontend/{$name}/',  
  9. ); 
  10.  
  11. /** 
  12. * Transforms the names 
  13. * @param array $vars 
  14. * @return array 
  15. */ 
  16. public function inflectPackageVars($vars) 
  17. if ($vars['type'] === 'shopware-theme') { 
  18. return $this->correctThemeName($vars); 
  19. } else { 
  20. return $this->correctPluginName($vars); 
  21.  
  22. /** 
  23. * Changes the name to a camelcased combination of vendor and name 
  24. * @param array $vars 
  25. * @return array 
  26. */ 
  27. private function correctPluginName($vars) 
  28. $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) { 
  29. return strtoupper($matches[0][1]); 
  30. }, $vars['name']); 
  31.  
  32. $vars['name'] = ucfirst($vars['vendor']) . ucfirst($camelCasedName); 
  33.  
  34. return $vars; 
  35.  
  36. /** 
  37. * Changes the name to a underscore separated name 
  38. * @param array $vars 
  39. * @return array 
  40. */ 
  41. private function correctThemeName($vars) 
  42. $vars['name'] = str_replace('-', '_', $vars['name']); 
  43.  
  44. return $vars;