# code-snippets/3.10.0/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php

Code Snippets, version 3.10.0. 37 lines.

- Page: https://pluginprobe.com/plugins/code-snippets/3.10.0/code/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php
- Raw: https://pluginprobe.com/plugins/code-snippets/3.10.0/raw/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php
- Modified: 2025-02-14T05:52:22+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/code-snippets/3.10.0/code/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php#L10-L20`.

```php
<?php

namespace Composer\Installers;

class CockpitInstaller extends BaseInstaller
{
    /** @var array<string, string> */
    protected $locations = array(
        'module' => 'cockpit/modules/addons/{$name}/',
    );

    /**
     * Format module name.
     *
     * Strip `module-` prefix from package name.
     */
    public function inflectPackageVars(array $vars): array
    {
        if ($vars['type'] == 'cockpit-module') {
            return $this->inflectModuleVars($vars);
        }

        return $vars;
    }

    /**
     * @param array<string, string> $vars
     * @return array<string, string>
     */
    public function inflectModuleVars(array $vars): array
    {
        $vars['name'] = ucfirst($this->pregReplace('/cockpit-/i', '', $vars['name']));

        return $vars;
    }
}

```
