<?php namespace LakeDrops\Component\Composer; use Composer\Command\BaseCommand as ComposerBaseCommand; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; /** * Base class for Composer commands to easily initialize the handler. * * @package LakeDrops\Component\Composer */ abstract class BaseCommand extends ComposerBaseCommand implements BaseCommandInterface { /** * The handler object to do the real work then. * * @var \LakeDrops\Component\Composer\BaseHandlerInterface */ protected BaseHandlerInterface $handler; /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output): int { $class = $this->getHandlerClass(); $this->handler = new $class($this->requireComposer(), $this->getIO()); $this->handler->setInput($input); return 0; } }