Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TastyIgniter Installer #502

Merged
merged 11 commits into from
Feb 11, 2022
18 changes: 15 additions & 3 deletions src/Composer/Installers/TastyIgniterInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,25 @@ class TastyIgniterInstaller extends BaseInstaller
*/
public function inflectPackageVars(array $vars): array
{
$extra = $this->composer->getPackage()->getExtra();

if ($vars['type'] === 'tastyigniter-extension') {
$vars['vendor'] = $this->pregReplace('/[^a-z0-9_]/i', '', $vars['vendor']);
$vars['name'] = $this->pregReplace('/^ti-ext-/', '', $vars['name']);
if (!empty($extra['tastyigniter-extension']['code'])) {
$parts = explode('.', $extra['tastyigniter-extension']['code']);
$vars['vendor'] = $parts[0];
$vars['name'] = $parts[1] ?? '';
}

$vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
$vars['name'] = preg_replace('/^ti-ext-/', '', (string)$vars['name']);
}

if ($vars['type'] === 'tastyigniter-theme') {
$vars['name'] = $this->pregReplace('/^ti-theme-/', '', $vars['name']);
if (!empty($extra['tastyigniter-theme']['code'])) {
$vars['name'] = $extra['tastyigniter-theme']['code'];
}

$vars['name'] = preg_replace('/^ti-theme-/', '', $vars['name']);
}

return $vars;
Expand Down