diff vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php	Fri Feb 23 15:52:07 2018 +0000
@@ -0,0 +1,37 @@
+<?php
+namespace Composer\Installers;
+
+/**
+ * Plugin/theme installer for majima
+ * @author David Neustadt
+ */
+class MajimaInstaller extends BaseInstaller
+{
+    protected $locations = array(
+        'plugin' => 'plugins/{$name}/',
+    );
+
+    /**
+     * Transforms the names
+     * @param  array $vars
+     * @return array
+     */
+    public function inflectPackageVars($vars)
+    {
+        return $this->correctPluginName($vars);
+    }
+
+    /**
+     * Change hyphenated names to camelcase
+     * @param  array $vars
+     * @return array
+     */
+    private function correctPluginName($vars)
+    {
+        $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
+            return strtoupper($matches[0][1]);
+        }, $vars['name']);
+        $vars['name'] = ucfirst($camelCasedName);
+        return $vars;
+    }
+}