2 namespace Composer\Installers;
5 * Plugin/theme installer for shopware
6 * @author Benjamin Boit
8 class ShopwareInstaller extends BaseInstaller
10 protected $locations = array(
11 'backend-plugin' => 'engine/Shopware/Plugins/Local/Backend/{$name}/',
12 'core-plugin' => 'engine/Shopware/Plugins/Local/Core/{$name}/',
13 'frontend-plugin' => 'engine/Shopware/Plugins/Local/Frontend/{$name}/',
14 'theme' => 'templates/{$name}/',
15 'plugin' => 'custom/plugins/{$name}/',
16 'frontend-theme' => 'themes/Frontend/{$name}/',
20 * Transforms the names
24 public function inflectPackageVars($vars)
26 if ($vars['type'] === 'shopware-theme') {
27 return $this->correctThemeName($vars);
29 return $this->correctPluginName($vars);
34 * Changes the name to a camelcased combination of vendor and name
38 private function correctPluginName($vars)
40 $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
41 return strtoupper($matches[0][1]);
44 $vars['name'] = ucfirst($vars['vendor']) . ucfirst($camelCasedName);
50 * Changes the name to a underscore separated name
54 private function correctThemeName($vars)
56 $vars['name'] = str_replace('-', '_', $vars['name']);