You are here

public function CakePHPInstaller::inflectPackageVars in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php \Composer\Installers\CakePHPInstaller::inflectPackageVars()

Format package name to CamelCase

Overrides BaseInstaller::inflectPackageVars

File

vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php, line 18

Class

CakePHPInstaller

Namespace

Composer\Installers

Code

public function inflectPackageVars($vars) {
  if ($this
    ->matchesCakeVersion('>=', '3.0.0')) {
    return $vars;
  }
  $nameParts = explode('/', $vars['name']);
  foreach ($nameParts as &$value) {
    $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
    $value = str_replace(array(
      '-',
      '_',
    ), ' ', $value);
    $value = str_replace(' ', '', ucwords($value));
  }
  $vars['name'] = implode('/', $nameParts);
  return $vars;
}