Created
June 28, 2016 04:29
-
-
Save sunel/fb4551be185eddfa9c45be94168613c4 to your computer and use it in GitHub Desktop.
Autoload problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "thl/admin-module", | |
"type": "thl-module", | |
"description": "The admin module.", | |
"keywords": [ | |
"thl", | |
"core" | |
], | |
"license": "MIT", | |
"authors": [ | |
{ | |
"name": "Sunel TR", | |
"email": "sunelbe@gmail.com" | |
} | |
], | |
"require": { | |
"php": ">=5.5", | |
"thl/composer-installer": "dev-master" | |
}, | |
"require-dev": { | |
"phpunit/phpunit": "~4.0" | |
}, | |
"suggest": { | |
}, | |
"autoload-dev": { | |
"psr-4": { | |
"Modules\\Admin\\": "src/" | |
} | |
}, | |
"extra": { | |
"branch-alias": { | |
"dev-master": "1.0-dev" | |
} | |
}, | |
"minimum-stability": "dev", | |
"prefer-stable": true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace THL\Installer; | |
class ThlInstaller extends BaseInstaller | |
{ | |
protected $locations = array( | |
'module' => 'Modules/{$name}/', | |
'theme' => 'Themes/{$name}/' | |
); | |
/** | |
* Format package name. | |
* | |
* For package type asgard-module, cut off a trailing '-plugin' if present. | |
* | |
* For package type asgard-theme, cut off a trailing '-theme' if present. | |
* | |
*/ | |
public function inflectPackageVars($vars) | |
{ | |
if ($vars['type'] === 'thl-module') { | |
return $this->inflectPluginVars($vars); | |
} | |
if ($vars['type'] === 'thl-theme') { | |
return $this->inflectThemeVars($vars); | |
} | |
return $vars; | |
} | |
protected function inflectPluginVars($vars) | |
{ | |
$vars['name'] = ucfirst(preg_replace('/-module/', '', $vars['name'])); | |
return $vars; | |
} | |
protected function inflectThemeVars($vars) | |
{ | |
$vars['name'] = ucfirst(preg_replace('/-theme$/', '', $vars['name'])); | |
return $vars; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment