This runs the builder

@param Composer\Script\Event $event The event which is fired by Composer

@return bool Returns false, when there was an error
192185
public static function Go(Event $event)
    {
        $event->getIO()->writeError('<info>Updating .gitignore: </info>', false);

        $composer = $event->getComposer();
        $repositoryManager = $composer->getRepositoryManager();
        $installManager = $composer->getInstallationManager();
        $extraConfiguration = $composer->getPackage()->getExtra();

        // Check in composer extra configuration if devOnly option is set
        $devRequires = (array_key_exists('autogitignore', $extraConfiguration)
            && $extraConfiguration['autogitignore'] == 'devOnly');

        // If devOnly option is set
        if ($devRequires) {
            // Grab original list of all require-dev packages
            $devRequires = array_keys($composer->getPackage()->getDevRequires());
            // Grab original list of all require packages
            $requires = array_keys($composer->getPackage()->getRequires());

            // Grab recursively require and require-dev packages
            foreach ($repositoryManager->getLocalRepository()->getPackages() as $package) {
                $devRequires = array_merge($devRequires, array_keys($package->getDevRequires()));
                $requires = array_merge($requires, array_keys($package->getRequires()));
            }

            // Remove duplicates
            $devRequires = array_unique($devRequires);
            $requires = array_unique($requires);

            // Sort packages
            sort($devRequires);
            sort($requires);
        }

        $packages = array();
        foreach ($repositoryManager->getLocalRepository()->getPackages() as $package) {
            // Test if we need to ignore the package
            // If the option devOnly is set, we check that
            // the package is not in the list of require-dev
            // OR is set in the list of require packages
            // before skipping.
            if ($devRequires && (!in_array($package->getName(), $devRequires) || in_array($package->getName(), $requires))) {
                continue;
            }
            $path = $installManager->getInstallPath($package);
            $packages[] = '/' . preg_replace('~^' . preg_quote(str_replace('\\', '/', getcwd()) . '/') . '~', '', str_replace('\\', '/', realpath($path))) . '/';
        }

        $packages = array_unique($packages);
        sort($packages);

        try {
            $gitIgnoreFile = GitIgnoreFile::create(getcwd() . DIRECTORY_SEPARATOR . '.gitignore');
            $gitIgnoreFile->setLines($packages);
            $gitIgnoreFile->save();
        } catch (Exception $exception) {
            $event->getIO()->writeError('<info>Failed - ' . $exception->getMessage() . '</info>');

            return false;
        }

        $event->getIO()->writeError('<info>Done - ' . count($packages) . ' packages ignored.</info>');

        return true;
    }
1092036
public function hasListenerQueue($event): bool
    {
        if ($event instanceof EventInterface) {
            $event = $event->getName();
        }

        return isset($this->listeners[$event]);
    }
821076
public static function run($event)
    {
        static::$io = $event->getIO();
        static::$composer = $event->getComposer();

        // Set the root theme folder dir.
        static::set_root();

        // Display snap logo!
        static::write_intro();

        $strategy = static::$io->select(
            "\n<comment>Please choose a templating system for your theme:</comment>",
            static::$strategies,
            0
        );

        switch ($strategy) {
            case '0':
                static::$io->write("<info>Setup finished.\nEnjoy SnapWP!</info>");
                exit;
                break;

            case '1':
                static::install_blade();
                break;
        }
    }
119168
public function runHandler(Event $event)
    {
        if (is_callable($this->handler)) {
            return call_user_func($this->handler, $event);
        }
        return false;
    }
881764
function handle(Event $event)
    {
        if ($this->accept($event)) {
            $this->onEvent($event);
            return true;
        }

        return false;
    }
34460
public static function postInstall(Event $event)
    {
        require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php';

        static::clearCompiled();
        static::artisanOptimize();
        static::artisanLangJS();
    }
957953
public function runConsoleApplication(Event $event)
    {
        /** @var Router $router */
        $router = Container::get('router');
        if ($router->getBundle() !== 'migrations') {
            return;
        }

        if (!defined('PHINX_VERSION')) {
            define('PHINX_VERSION', (0 === strpos('@PHINX_VERSION@', '@PHINX_VERSION')) ? '0.4.1' : '@PHINX_VERSION@');
        }

        array_shift($_SERVER['argv']);
        if ($_SERVER['argv']) {
            $path = $_SERVER['argv'][0];
            unset($_SERVER['argv'][0]);
            $_SERVER['argv'] = array_merge(explode(':', $path), $_SERVER['argv']);
        }

        $app = new ConsoleApplication('Migrations plugin, based on Phinx by Rob Morgan.', PHINX_VERSION);
        $app->add(new Status());
        $app->add(new Create());
        $app->add(new Migrate());
        $app->add(new Rollback());
        $app->run();
    }
878995
public function trigger(Event $event)
	{
		$this->called = true;

		//$e = $this->stopwatch->start($this->name, 'event_listener');

		if ($this->listener instanceof Closure)
		{
			$response = call_user_func($this->listener, $event);
		}
		else
		{
			$response = call_user_func(array($this->listener, $event->getName()), $event);
		}

		/*if ($e->isStarted())
		{
			$e->stop();
		}*/

		if ($event->isStopped())
		{
			$this->stoppedPropagation = true;
		}

		return $response;
	}
1015274
protected function create(Event $event)
    {
        $this->dispatch(static::EVENT_CREATE_BEFORE, $event);
        if (!$event->isPropagationStopped()) {
            $this->createProcess($event);
            if (!$event->isPropagationStopped()) {
                $this->dispatch(static::EVENT_CREATE_AFTER, $event);
            }
        }
    }
162953
public static function execute(Event $event) {
    $io = $event->getIO();

    // Search upwards for a composer.json which depends on Open Social.
    $io->write('Searching for root package...');

    $file = static::getRootPackage();

    $package = $file->read();

    // Add the Asset Packagist repository if it does not already exist.
    if (isset($package['repositories'])) {
      $repository_key = NULL;

      foreach ($package['repositories'] as $key => $repository) {
        if ($repository['type'] == 'composer' && strpos($repository['url'], 'https://asset-packagist.org') === 0) {
          $repository_key = $key;
          break;
        }
      }

      if (is_null($repository_key)) {
        $package['repositories'][] = [
          'type' => 'composer',
          'url' => 'https://asset-packagist.org',
        ];
      }
    }

    // oomphinc/composer-installers-extender is required by Open Social and
    // depends on composer/installers, so it does not need to be specifically
    // included.
    unset(
      $package['require']['oomphinc/composer-installers-extender']
    );

    // Check if we need to add the bower and npm assets to the installer types.
    if (!isset($package['extra']['installer-types']) || !in_array('bower-asset', $package['extra']['installer-types'])) {
      $package['extra']['installer-types'][] = 'bower-asset';
    }
    if (!in_array('npm-asset', $package['extra']['installer-types'])) {
      $package['extra']['installer-types'][] = 'npm-asset';
    }

    // Get root folder based on the location of Drupal core. If we do it in this
    // way we can also support projects that have
    //    $package['extra']['installer-paths']['']
    $root_path = 'html/';
    foreach ($package['extra']['installer-paths'] as $path => $install_type) {
      if (in_array('drupal/core', $install_type, TRUE)) {
        // If Drupal core is installed in the root path we also want the
        // libraries there.
        if ($path == 'core') {
          $root_path = '';
        }
        else {
          $parts = explode('/core', $path);
          if (!empty($parts)) {
            $root_path = $parts[0] . '/';
          }
        }

        break;
      }
    }

    // Add the different library types to the installer paths.
    $package['extra']['installer-paths'][$root_path . 'libraries/{$name}'][] = 'type:drupal-library';
    $package['extra']['installer-paths'][$root_path . 'libraries/{$name}'][] = 'type:bower-asset';
    $package['extra']['installer-paths'][$root_path . 'libraries/{$name}'][] = 'type:npm-asset';

    $file->write($package);
    $io->write('Successfully updated your root composer.json file.');
  }
992524
public function onNewCodeEvent(Event $event)
    {
        $vendorDir   = $event->getComposer()->getConfig()->get('vendor-dir');
        $projectDir  = dirname($vendorDir);
        $phpStormDir = $projectDir . DIRECTORY_SEPARATOR . '.idea';
        $filesDir    = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'files';

        if (is_dir($phpStormDir) && is_dir($filesDir)) {
            $this->patcher->patch(
                new Environment(
                    new Filesystem($phpStormDir),
                    new Filesystem($filesDir),
                    new Filesystem($projectDir),
                    $event->getIO(),
                    $event->getComposer()
                )
            );

            $output = $event->getIO();
            if ($output->isVerbose()) {
                $output->write('Patched the PhpStorm config');
            }
        }
    }
815099
public static function trigger($event, $data = null)
	{
		if (!is_array($data)) {
			$data = array($data);
		}

		if (empty(self::$events[$event])) {
			return true;
		}
		
		foreach (self::$events[$event] as $callback) {
			if (!is_callable($callback)) {
				continue;
			}
			call_user_func_array($callback, $data);
		}
		
		return true;
	}
1330717
protected static function bootLaravel(Event $event) {
        $dir = dirname($event->getComposer()->getConfig()->get('vendor-dir'));

        require $dir . '/bootstrap/autoload.php';

        /* @var $app \Illuminate\Foundation\Application */
        self::$app = require_once $dir . '/bootstrap/app.php';

        self::$kernel = $app->make(\Illuminate\Contracts\Console\Kernel::class);

        self::$kernel->bootstrap();

        self::instantiateConsoleInteraction($event);
    }
587333
public static function configureProject(Event $event)
    {
        DirectoryConfigurator::fromEvent($event)->run();
        BundleConfigurator::fromEvent($event)->run();

        // Install assets here since they they were skipped above
        static::installAssets($event, false);
    }
485387
public function handle($event)
    {
        $method = $this->getMethodFor($event);

        if (method_exists($this, $method)) {
            return call_user_func([$this, $method], $event);
        }
    }
771521
public function handleServiceEvent($event)
    {
        Log::debug('Service event handled: ' . $event->name);

        if ($script = $this->getEventScript($event->name)) {
            Log::debug('Service event script found: ' . $event->name);
            $data = $event->makeData();

            if (null !== $result = $this->handleEventScript($script, $data)) {
                return $this->handleEventScriptResult($script, $result);
            }
        } elseif ($script = $this->getEventScript($event->name . '.queued')) {
            Log::debug('Queued service event script found: ' . $event->name);
            $result = $this->dispatchNow(new ServiceEventScriptJob($event->name . '.queued', $event, $script->config));
            Log::debug('Service event queued: ' . $event->name . PHP_EOL . $result);
        }

        return true;
    }
70465
public function match(Event $event) : bool
    {
        $filter = $this->filter;
        if (!$filter) {
            return true;
        }
        if (is_string($filter)){
            return $this->matchEventName($filter, $event);
        }
        if (is_callable($filter)){
            return ($filter)($event);
        }
        return false;
    }