<commit_before><?php
/*
 * This file is part of the codeliner/ginger-plugin-installer package.
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace GingerPluginInstaller\Composer;

use GingerPluginInstaller\Exception;
use GingerPluginInstaller\Cqrs;
use Composer\Installer\LibraryInstaller;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Package\PackageInterface;
use Composer\Repository\InstalledRepositoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
/**
 * Composer plugin class
 * 
 * @author <NAME> <<EMAIL>>
 */
class GingerInstaller extends LibraryInstaller
{
    /**
     * @var Composer
     */
    protected $composer;
    
    /**
     * @var ServiceLocatorInterface 
     */
    protected $serviceManager;
    
    protected $packageTypes = array(
        'ginger-frontend-plugin',
        'ginger-backend-plugin'
    );


    public function __construct(IOInterface $io, Composer $composer)
    {
        parent::__construct($io, $composer);
        
        $this->composer = $composer;
        
        $this->initGingerBackend();
    }
    
    public function supports($packageType)
    {
        return in_array($packageType, $this->packageTypes);
    }
    
    public function getInstallPath(PackageInterface $package)
    {
        return 'plugin';
    }
    
    public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
    {
        $this->initGingerBackend();
        
        $extra = $package->getExtra();
        
        if (!isset($extra['plugin-namespace'])) {
            throw new Exception\RuntimeException(
                sprintf(
                    'Missing the key -plugin-namespace- in the -extra- property of the plugin -%s- composer.json.',<commit_msg>Lazy bootstrap the Ginger Backend and cache ServiceManager instance<commit_after><?php
/*
 * This file is part of the codeliner/ginger-plugin-installer package.
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace GingerPluginInstaller\Composer;

use GingerPluginInstaller\Exception;
use GingerPluginInstaller\Cqrs;
use Composer\Installer\LibraryInstaller;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Package\PackageInterface;
use Composer\Repository\InstalledRepositoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
/**
 * Composer plugin class
 * 
 * @author <NAME> <<EMAIL>>
 */
class GingerInstaller extends LibraryInstaller
{
    /**
     * @var Composer
     */
    protected $composer;
    
    /**
     * @var ServiceLocatorInterface 
     */
    protected $serviceManager;
    
    protected $packageTypes = array(
        'ginger-frontend-plugin',
        'ginger-backend-plugin'
    );


    public function __construct(IOInterface $io, Composer $composer)
    {
        parent::__construct($io, $composer);
        
        $this->composer = $composer;
    }
    
    public function supports($packageType)
    {
        return in_array($packageType, $this->packageTypes);
    }
    
    public function getInstallPath(PackageInterface $package)
    {
        return 'plugin';
    }
    
    public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
    {
        $this->initGingerBackend();
        
        $extra = $package->getExtra();
        
        if (!isset($extra['plugin-namespace'])) {
            throw new Exception\RuntimeException(
                sprintf(
                    'Missing the key -plugin-namespace- in the -extra- property of the plugin -%s- composer.json.',
{'fraction_non_alphanumeric': 0.10242731395038678, 'fraction_numerical': 0.0, 'mean_word_length': 2.8501026694045173, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1688535', 'n_tokens_mistral': 1036, 'n_tokens_neox': 1027, 'n_words': 252}