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

Breadcrumb

  1. Drupal Core 11.1.x

SyDESInstaller.php

Namespace

Composer\Installers

File

vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php

View source
<?php

namespace Composer\Installers;

class SyDESInstaller extends BaseInstaller {
    
    /** @var array<string, string> */
    protected $locations = array(
        'module' => 'app/modules/{$name}/',
        'theme' => 'themes/{$name}/',
    );
    
    /**
     * Format module name.
     *
     * Strip `sydes-` prefix and a trailing '-theme' or '-module' from package name if present.
     */
    public function inflectPackageVars(array $vars) : array {
        if ($vars['type'] == 'sydes-module') {
            return $this->inflectModuleVars($vars);
        }
        if ($vars['type'] === 'sydes-theme') {
            return $this->inflectThemeVars($vars);
        }
        return $vars;
    }
    
    /**
     * @param array<string, string> $vars
     * @return array<string, string>
     */
    public function inflectModuleVars(array $vars) : array {
        $vars['name'] = $this->pregReplace('/(^sydes-|-module$)/i', '', $vars['name']);
        $vars['name'] = str_replace(array(
            '-',
            '_',
        ), ' ', $vars['name']);
        $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
        return $vars;
    }
    
    /**
     * @param array<string, string> $vars
     * @return array<string, string>
     */
    protected function inflectThemeVars(array $vars) : array {
        $vars['name'] = $this->pregReplace('/(^sydes-|-theme$)/', '', $vars['name']);
        $vars['name'] = strtolower($vars['name']);
        return $vars;
    }

}

Classes

Title Deprecated Summary
SyDESInstaller

API Navigation

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