AglInstaller.php
4 years ago
AimeosInstaller.php
4 years ago
AnnotateCmsInstaller.php
4 years ago
AsgardInstaller.php
4 years ago
AttogramInstaller.php
4 years ago
BaseInstaller.php
4 years ago
BitrixInstaller.php
4 years ago
BonefishInstaller.php
4 years ago
CakePHPInstaller.php
4 years ago
ChefInstaller.php
4 years ago
CiviCrmInstaller.php
4 years ago
ClanCatsFrameworkInstaller.php
4 years ago
CockpitInstaller.php
4 years ago
CodeIgniterInstaller.php
4 years ago
Concrete5Installer.php
4 years ago
CraftInstaller.php
4 years ago
CroogoInstaller.php
4 years ago
DecibelInstaller.php
4 years ago
DframeInstaller.php
4 years ago
DokuWikiInstaller.php
4 years ago
DolibarrInstaller.php
4 years ago
DrupalInstaller.php
4 years ago
ElggInstaller.php
4 years ago
EliasisInstaller.php
4 years ago
ExpressionEngineInstaller.php
4 years ago
EzPlatformInstaller.php
4 years ago
FuelInstaller.php
4 years ago
FuelphpInstaller.php
4 years ago
GravInstaller.php
4 years ago
HuradInstaller.php
4 years ago
ImageCMSInstaller.php
4 years ago
Installer.php
4 years ago
ItopInstaller.php
4 years ago
JoomlaInstaller.php
4 years ago
KanboardInstaller.php
4 years ago
KirbyInstaller.php
4 years ago
KnownInstaller.php
4 years ago
KodiCMSInstaller.php
4 years ago
KohanaInstaller.php
4 years ago
LanManagementSystemInstaller.php
4 years ago
LaravelInstaller.php
4 years ago
LavaLiteInstaller.php
4 years ago
LithiumInstaller.php
4 years ago
MODULEWorkInstaller.php
4 years ago
MODXEvoInstaller.php
4 years ago
MagentoInstaller.php
4 years ago
MajimaInstaller.php
4 years ago
MakoInstaller.php
4 years ago
MantisBTInstaller.php
4 years ago
MauticInstaller.php
4 years ago
MayaInstaller.php
4 years ago
MediaWikiInstaller.php
4 years ago
MiaoxingInstaller.php
4 years ago
MicroweberInstaller.php
4 years ago
ModxInstaller.php
4 years ago
MoodleInstaller.php
4 years ago
OctoberInstaller.php
4 years ago
OntoWikiInstaller.php
4 years ago
OsclassInstaller.php
4 years ago
OxidInstaller.php
4 years ago
PPIInstaller.php
4 years ago
PantheonInstaller.php
4 years ago
PhiftyInstaller.php
4 years ago
PhpBBInstaller.php
4 years ago
PimcoreInstaller.php
4 years ago
PiwikInstaller.php
4 years ago
PlentymarketsInstaller.php
4 years ago
Plugin.php
4 years ago
PortoInstaller.php
4 years ago
PrestashopInstaller.php
4 years ago
ProcessWireInstaller.php
4 years ago
PuppetInstaller.php
4 years ago
PxcmsInstaller.php
4 years ago
RadPHPInstaller.php
4 years ago
ReIndexInstaller.php
4 years ago
Redaxo5Installer.php
4 years ago
RedaxoInstaller.php
4 years ago
RoundcubeInstaller.php
4 years ago
SMFInstaller.php
4 years ago
ShopwareInstaller.php
4 years ago
SilverStripeInstaller.php
4 years ago
SiteDirectInstaller.php
4 years ago
StarbugInstaller.php
4 years ago
SyDESInstaller.php
4 years ago
SyliusInstaller.php
4 years ago
Symfony1Installer.php
4 years ago
TYPO3CmsInstaller.php
4 years ago
TYPO3FlowInstaller.php
4 years ago
TaoInstaller.php
4 years ago
TastyIgniterInstaller.php
4 years ago
TheliaInstaller.php
4 years ago
TuskInstaller.php
4 years ago
UserFrostingInstaller.php
4 years ago
VanillaInstaller.php
4 years ago
VgmcpInstaller.php
4 years ago
WHMCSInstaller.php
4 years ago
WinterInstaller.php
4 years ago
WolfCMSInstaller.php
4 years ago
WordPressInstaller.php
4 years ago
YawikInstaller.php
4 years ago
ZendInstaller.php
4 years ago
ZikulaInstaller.php
4 years ago
CakePHPInstaller.php
67 lines
| 1 | <?php |
| 2 | namespace Composer\Installers; |
| 3 | |
| 4 | use Composer\DependencyResolver\Pool; |
| 5 | use Composer\Semver\Constraint\Constraint; |
| 6 | |
| 7 | class CakePHPInstaller extends BaseInstaller |
| 8 | { |
| 9 | protected $locations = array( |
| 10 | 'plugin' => 'Plugin/{$name}/', |
| 11 | ); |
| 12 | |
| 13 | /** |
| 14 | * Format package name to CamelCase |
| 15 | */ |
| 16 | public function inflectPackageVars($vars) |
| 17 | { |
| 18 | if ($this->matchesCakeVersion('>=', '3.0.0')) { |
| 19 | return $vars; |
| 20 | } |
| 21 | |
| 22 | $nameParts = explode('/', $vars['name']); |
| 23 | foreach ($nameParts as &$value) { |
| 24 | $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value)); |
| 25 | $value = str_replace(array('-', '_'), ' ', $value); |
| 26 | $value = str_replace(' ', '', ucwords($value)); |
| 27 | } |
| 28 | $vars['name'] = implode('/', $nameParts); |
| 29 | |
| 30 | return $vars; |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Change the default plugin location when cakephp >= 3.0 |
| 35 | */ |
| 36 | public function getLocations() |
| 37 | { |
| 38 | if ($this->matchesCakeVersion('>=', '3.0.0')) { |
| 39 | $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/'; |
| 40 | } |
| 41 | return $this->locations; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Check if CakePHP version matches against a version |
| 46 | * |
| 47 | * @param string $matcher |
| 48 | * @param string $version |
| 49 | * @return bool |
| 50 | * @phpstan-param Constraint::STR_OP_* $matcher |
| 51 | */ |
| 52 | protected function matchesCakeVersion($matcher, $version) |
| 53 | { |
| 54 | $repositoryManager = $this->composer->getRepositoryManager(); |
| 55 | if (! $repositoryManager) { |
| 56 | return false; |
| 57 | } |
| 58 | |
| 59 | $repos = $repositoryManager->getLocalRepository(); |
| 60 | if (!$repos) { |
| 61 | return false; |
| 62 | } |
| 63 | |
| 64 | return $repos->findPackage('cakephp/cakephp', new Constraint($matcher, $version)) !== null; |
| 65 | } |
| 66 | } |
| 67 |