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}/'
18 * Transforms the names
22 public function inflectPackageVars($vars)
24 if ($vars['type'] === 'shopware-theme') {
25 return $this->correctThemeName($vars);
27 return $this->correctPluginName($vars);
32 * Changes the name to a camelcased combination of vendor and name
36 private function correctPluginName($vars)
38 $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
39 return strtoupper($matches[0][1]);
42 $vars['name'] = ucfirst($vars['vendor']) . ucfirst($camelCasedName);
48 * Changes the name to a underscore separated name
52 private function correctThemeName($vars)
54 $vars['name'] = str_replace('-', '_', $vars['name']);