Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MajimaInstaller.php

function MajimaInstaller::correctPluginName

Change hyphenated names to camelcase

Parameters

array<string, string> $vars:

Return value

array<string, string>

1 call to MajimaInstaller::correctPluginName()
MajimaInstaller::inflectPackageVars in vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php
Transforms the names

File

vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php, line 33

Class

MajimaInstaller
Plugin/theme installer for majima @author David Neustadt

Namespace

Composer\Installers

Code

private function correctPluginName(array $vars) : array {
    $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
        return strtoupper($matches[0][1]);
    }, $vars['name']);
    if (null === $camelCasedName) {
        throw new \RuntimeException('Failed to run preg_replace_callback: ' . preg_last_error());
    }
    $vars['name'] = ucfirst($camelCasedName);
    return $vars;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal