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

Breadcrumb

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

class TastyIgniterInstaller

Hierarchy

  • class \Composer\Installers\BaseInstaller
    • class \Composer\Installers\TastyIgniterInstaller extends \Composer\Installers\BaseInstaller

Expanded class hierarchy of TastyIgniterInstaller

File

vendor/composer/installers/src/Composer/Installers/TastyIgniterInstaller.php, line 5

Namespace

Composer\Installers
View source
class TastyIgniterInstaller extends BaseInstaller {
    
    /** @var array<string, string> */
    protected $locations = [
        'module' => 'app/{$name}/',
        'extension' => 'extensions/{$vendor}/{$name}/',
        'theme' => 'themes/{$name}/',
    ];
    
    /**
     * Format package name.
     *
     * Cut off leading 'ti-ext-' or 'ti-theme-' if present.
     * Strip vendor name of characters that is not alphanumeric or an underscore
     *
     */
    public function inflectPackageVars(array $vars) : array {
        $extra = $this->package
            ->getExtra();
        if ($vars['type'] === 'tastyigniter-module') {
            return $this->inflectModuleVars($vars);
        }
        if ($vars['type'] === 'tastyigniter-extension') {
            return $this->inflectExtensionVars($vars, $extra);
        }
        if ($vars['type'] === 'tastyigniter-theme') {
            return $this->inflectThemeVars($vars, $extra);
        }
        return $vars;
    }
    
    /**
     * @param array<string, string> $vars
     * @return array<string, string>
     */
    protected function inflectModuleVars(array $vars) : array {
        $vars['name'] = $this->pregReplace('/^ti-module-/', '', $vars['name']);
        return $vars;
    }
    
    /**
     * @param array<string, string> $vars
     * @param array<string, mixed> $extra
     * @return array<string, string>
     */
    protected function inflectExtensionVars(array $vars, array $extra) : array {
        if (!empty($extra['tastyigniter-extension']['code'])) {
            $parts = explode('.', $extra['tastyigniter-extension']['code']);
            $vars['vendor'] = (string) $parts[0];
            $vars['name'] = (string) ($parts[1] ?? '');
        }
        $vars['vendor'] = $this->pregReplace('/[^a-z0-9_]/i', '', $vars['vendor']);
        $vars['name'] = $this->pregReplace('/^ti-ext-/', '', $vars['name']);
        return $vars;
    }
    
    /**
     * @param array<string, string> $vars
     * @param array<string, mixed> $extra
     * @return array<string, string>
     */
    protected function inflectThemeVars(array $vars, array $extra) : array {
        if (!empty($extra['tastyigniter-theme']['code'])) {
            $vars['name'] = $extra['tastyigniter-theme']['code'];
        }
        $vars['name'] = $this->pregReplace('/^ti-theme-/', '', $vars['name']);
        return $vars;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
BaseInstaller::$composer protected property @var Composer
BaseInstaller::$io protected property @var IOInterface
BaseInstaller::$package protected property @var PackageInterface
BaseInstaller::getInstallPath public function Return the install path based on package type. 2
BaseInstaller::getLocations public function Gets the installer&#039;s locations 2
BaseInstaller::mapCustomInstallPaths protected function Search through a passed paths array for a custom install path.
BaseInstaller::pregReplace protected function
BaseInstaller::templatePath protected function Replace vars in a path 1
BaseInstaller::__construct public function Initializes base installer.
TastyIgniterInstaller::$locations protected property @var array&lt;string, string&gt; Overrides BaseInstaller::$locations
TastyIgniterInstaller::inflectExtensionVars protected function
TastyIgniterInstaller::inflectModuleVars protected function
TastyIgniterInstaller::inflectPackageVars public function Format package name. Overrides BaseInstaller::inflectPackageVars
TastyIgniterInstaller::inflectThemeVars protected function

API Navigation

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