本文整理汇总了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();
}