Components_Pear_Environment::addComponent PHP Method

addComponent() public method

Add a component to the environemnt.
public addComponent ( string $component, string $install, array $options, string $info, string $reason = '', array $warnings = [] ) : null
$component string The name of the component that should be installed.
$install string The package that should be installed.
$options array PEAR specific installation opions.
$info string Installation details.
$reason string Optional reason for adding the package.
$warnings array Optional warnings that should be displayed to the user.
return null
    public function addComponent($component, $install, $options, $info, $reason = '', $warnings = array())
    {
        $installer = $this->getInstallationHandler();
        $this->_output->ok(sprintf('About to add component %s%s', $component, $reason));
        if (!empty($warnings)) {
            foreach ($warnings as $warning) {
                $this->_output->warn($warnings);
            }
        }
        ob_start();
        Components_Exception_Pear::catchError($installer->doInstall('install', $options, $install));
        $this->_output->pear(ob_get_clean());
        $this->_output->ok(sprintf('Successfully added component %s%s%s', $component, $info, $reason));
    }