本文整理匯總了PHP中Composer\Script\CommandEvent::getOperation方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommandEvent::getOperation方法的具體用法?PHP CommandEvent::getOperation怎麽用?PHP CommandEvent::getOperation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Composer\Script\CommandEvent
的用法示例。
在下文中一共展示了CommandEvent::getOperation方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: extensions
/**
* Composer post-package-install and post-package-update event handler
*
* @param CommandEvent $event
*/
public static function extensions(CommandEvent $event)
{
$installedPackage = $event->getOperation()->getPackage();
$rootExtra = $event->getComposer()->getPackage()->getExtra();
$extra = $installedPackage->getExtra();
if (isset($extra['bolt-assets'])) {
$type = $installedPackage->getType();
$pathToPublic = $rootExtra['bolt-web-path'];
// Get the path from extensions base through to public
$parts = array(getcwd(), $pathToPublic, "extensions", 'vendor', $installedPackage->getName(), $extra['bolt-assets']);
$path = join(DIRECTORY_SEPARATOR, $parts);
if ($type == 'bolt-extension' && isset($extra['bolt-assets'])) {
$fromParts = array(getcwd(), 'vendor', $installedPackage->getName(), $extra['bolt-assets']);
$fromPath = join(DIRECTORY_SEPARATOR, $fromParts);
$filesystem = new Filesystem();
$filesystem->mirror($fromPath, $path);
}
}
}
示例2: postPackageInstall
public static function postPackageInstall(CommandEvent $event)
{
$installedPackage = $event->getOperation()->getPackage();
}