Skip to content

Commit

Permalink
Update TastyIgniter Installer (#502)
Browse files Browse the repository at this point in the history
* Update TastyIgniter Installer

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>

* fix phpstan issues

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>

* fix phpstan issues

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>

* fix phpstan issues

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>

* fix phpstan issues

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>

* fix phpstan issues

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>

* fix phpstan issues

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>

* fix phpstan issues

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>

* fix phpstan issues

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>

* fix phpstan issues

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>

* fix phpstan issues

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>
  • Loading branch information
sampoyigi committed Feb 11, 2022
1 parent 5b4f733 commit e6facf8
Showing 1 changed file with 15 additions and 3 deletions.
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

0 comments on commit e6facf8

Please sign in to comment.