src/EventSubscriber.php
protected function getPackage(PackageEvent $event)
    {
        $operation = $event->getOperation();
        
        if (method_exists($operation, 'getPackage')) {
            return $operation->getPackage();
        }
        
        return $operation->getTargetPackage();
    }
protected function getPackage(PackageEvent $event)
    {
        $operation = $event->getOperation();
        
        if (method_exists($operation, 'getPackage')) {
            return $operation->getPackage();
        }
        
        return $operation->getTargetPackage();
    }
protected function getPackage ( PackageEvent $ event ) { $ operation = $ event -> getOperation ( ) ; if ( method_exists ( $ operation , 'getPackage' ) ) { return $ operation -> getPackage ( ) ; } return $ operation -> getTargetPackage ( ) ; }
Get the PackageInterface from a PackageEvent.

@param  \Composer\Installer\PackageEvent  $event
@return \Composer\Package\PackageInterface
Get the PackageInterface from a PackageEvent .