protected function getPackage(PackageEvent $event)
    {
        $operation = $event->getOperation();
        
        if (method_exists($operation, 'getPackage')) {
            return $operation->getPackage();
        }
        
        return $operation->getTargetPackage();
    }