public function handleUninstall(PackageEvent $event): void
    {
        if (!$this->enabled) {
            return;
        }

        $operation = $event->getOperation();
        if ($operation instanceof UninstallOperation) {
            $package = $operation->getPackage();
            if (in_array($package->getName(), $this->excluded)) {
                $this->io->write(sprintf('<info>Rikudou installer: Package %s ignored in composer settings</info>', $package->getName()));

                return;
            }
            $this->projectType = ProjectTypeGetter::get($this->composer);
            if (is_null($this->projectType)) {
                return;
            }
            $handler = new PackageHandler($package, $this->projectType, $this->composer);
            if ($handler->canBeHandled()) {
                $this->io->write('<comment>=== [Rikudou Installer] ===</comment>');
                foreach ($handler->handleUninstall() as $operationResult) {
                    foreach ($operationResult->getMessagesCollection()->getGenerator() as $message) {
                        if ($message->isStatusMessage() || $message->isWarningMessage()) {
                            $this->io->write($message->getMessage());
                        } else {
                            $this->io->writeError($message->getMessage());
                        }
                    }
                }
                $this->io->write('<comment>=== [Rikudou Installer] ===</comment>');
            }
        }
    }
public function handleUninstall(PackageEvent $event): void
    {
        if (!$this->enabled) {
            return;
        }

        $operation = $event->getOperation();
        if ($operation instanceof UninstallOperation) {
            $package = $operation->getPackage();
            if (in_array($package->getName(), $this->excluded)) {
                $this->io->write(sprintf('<info>Rikudou installer: Package %s ignored in composer settings</info>', $package->getName()));

                return;
            }
            $this->projectType = ProjectTypeGetter::get($this->composer);
            if (is_null($this->projectType)) {
                return;
            }
            $handler = new PackageHandler($package, $this->projectType, $this->composer);
            if ($handler->canBeHandled()) {
                $this->io->write('<comment>=== [Rikudou Installer] ===</comment>');
                foreach ($handler->handleUninstall() as $operationResult) {
                    foreach ($operationResult->getMessagesCollection()->getGenerator() as $message) {
                        if ($message->isStatusMessage() || $message->isWarningMessage()) {
                            $this->io->write($message->getMessage());
                        } else {
                            $this->io->writeError($message->getMessage());
                        }
                    }
                }
                $this->io->write('<comment>=== [Rikudou Installer] ===</comment>');
            }
        }
    }
public function handleUninstall ( PackageEvent $ event ) : void { if ( ! $ this -> enabled ) { return ; } $ operation = $ event -> getOperation ( ) ; if ( $ operation instanceof UninstallOperation ) { $ package = $ operation -> getPackage ( ) ; if ( in_array ( $ package -> getName ( ) , $ this -> excluded ) ) { $ this -> io -> write ( sprintf ( '<info>Rikudou installer: Package %s ignored in composer settings</info>' , $ package -> getName ( ) ) ) ; return ; } $ this -> projectType = ProjectTypeGetter :: get ( $ this -> composer ) ; if ( is_null ( $ this -> projectType ) ) { return ; } $ handler = new PackageHandler ( $ package , $ this -> projectType , $ this -> composer ) ; if ( $ handler -> canBeHandled ( ) ) { $ this -> io -> write ( '<comment>=== [Rikudou Installer] ===</comment>' ) ; foreach ( $ handler -> handleUninstall ( ) as $ operationResult ) { foreach ( $ operationResult -> getMessagesCollection ( ) -> getGenerator ( ) as $ message ) { if ( $ message -> isStatusMessage ( ) || $ message -> isWarningMessage ( ) ) { $ this -> io -> write ( $ message -> getMessage ( ) ) ; } else { $ this -> io -> writeError ( $ message -> getMessage ( ) ) ; } } } $ this -> io -> write ( '<comment>=== [Rikudou Installer] ===</comment>' ) ; } } }
Tries to uninstall the package

@param PackageEvent $event
Tries to uninstall the package