Created
June 15, 2015 11:36
-
-
Save sbuzonas/50f3a450650b9a193e44 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
public function getInstaller($type) | |
{ | |
// Plugin API 1.1 | |
foreach ($pm->getCapabilities('Composer\Plugin\Capability\Installable') as $installCap) { | |
if ($installCap->supports($type)) { | |
return $installCap; | |
} | |
} | |
// Plugin API 1.2 | |
foreach ($pm->getCapabilities('Composer\Plugin\Capability\Installable2') as $capability) { | |
// some other setup | |
} | |
} | |
public function getInstaller($type) | |
{ | |
/** | |
* Plugin API 5.0 | |
* Composer drops support for "Installable". | |
* "Installable2" is renamed to "Installable" | |
*/ | |
foreach ($pm->getAllPluginCapabilities('Composer\Plugin\Capability\Installable') as $installCap) { | |
// some setup | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment