Builds the bootstrap file.

The bootstrap file contains PHP file that are always needed by the application.
It speeds up the application bootstrapping.

@param Event $event
974548
public static function buildBootstrap(Event $event)
    {
        $options = static::getOptions($event);
        $bootstrapDir = $autoloadDir = $options['symfony-app-dir'];

        if (static::useNewDirectoryStructure($options)) {
            $bootstrapDir = $options['symfony-var-dir'];
            if (!static::hasDirectory($event, 'symfony-var-dir', $bootstrapDir, 'build bootstrap file')) {
                return;
            }
        }

        if (!static::useSymfonyAutoloader($options)) {
            $autoloadDir = $options['vendor-dir'];
        }

        if (!static::hasDirectory($event, 'symfony-app-dir', $autoloadDir, 'build bootstrap file')) {
            return;
        }

        static::executeBuildBootstrap($event, $bootstrapDir, $autoloadDir, $options['process-timeout']);
    }
912698
protected function _buildLocalPath(Event $Event) {
		$data = $Event->getData();
		extract($data);

		$path = $this->_buildPath($image, true, $hash);
		$Event->setData('path', $Event->result = '/' . $path);
		$Event->stopPropagation();
	}
376173
public function buildAttribute(BuildAttributeEvent $event)
    {
        $attribute = $event->getAttribute();
        if (!($attribute instanceof File) || !$attribute->get('file_multiple')) {
            return;
        }

        $container  = $event->getContainer();
        $properties = $container->getPropertiesDefinition();
        $name       = $attribute->getColName();
        $nameSort   = \sprintf('%s__sort', $name);

        if ($properties->hasProperty($nameSort)) {
            $this->addAttributeToDefinition($container, $name);
            $properties->getProperty($name . '__sort')->setWidgetType('fileTreeOrder');

            return;
        }

        $properties->addProperty($property = new DefaultProperty($name . '__sort'));
        $property->setWidgetType('fileTreeOrder');

        $this->addAttributeToDefinition($container, $name);
    }
961667
public function buildStarted(BuildEvent $event)
    {
        $this->startTime = Phing::currentTimeMillis();
        if ($this->msgOutputLevel >= Project::MSG_INFO) {
            $this->printMessage(
                "Buildfile: " . $event->getProject()->getProperty("phing.file"),
                $this->out,
                Project::MSG_INFO
            );
        }
    }
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);
    }
333864
public function onVichUploaderPostUpload(Event $event)
    {
        $object = $event->getObject();
        $mapping = $event->getMapping();

        $absoluteDir = $mapping->getUploadDestination().'/'.$mapping->getUploadDir($object);
        $relativeDir = substr_replace($absoluteDir, '', 0, strlen($this->projectDir) + 1);

        $object->setRelativeDir($relativeDir);

        if (false !== strpos($object->getMimeType(), 'image/')) {
            $img = $mapping->getUploadDestination().'/'.$mapping->getUploadDir($object).'/'.$object->getMedia();
            $palette = Palette::fromFilename($img, Color::fromHexToInt('#FFFFFF'));
            $extractor = new ColorExtractor($palette);
            $colors = $extractor->extract();
            $object->setMainColor(Color::fromIntToHex($colors[0]));

            $this->generateCache('/'.$relativeDir.'/'.$object->getMedia());
        }
    }
411551
public function __constructBootstrap()
    {
        $this->registerEvent(
            'OnResourceInit',
            function () {
                $bootstrapAssetUrl = $this->getResourceManager()
                    ->publishAssetFolder(realpath(dirname(__FILE__)."/bootstrap"));
                $jqueryAssetUrl = $this->getResourceManager()
                    ->publishAssetFolder(realpath(dirname(__FILE__)."/jquery"));
                $resources = array(
                    "js"=>array(
                        $jqueryAssetUrl."/jquery.min.js",
                        array(
                            $bootstrapAssetUrl."/js/bootstrap.min.js"
                        )
                    ),
                    "css"=>array(
                        $bootstrapAssetUrl."/css/bootstrap.min.css",
                        $bootstrapAssetUrl."/css/bootstrap-theme.min.css"
                    )
                );
                $this->getResourceManager()
                    ->addScriptOnBegin("KoolReport.load.resources(".json_encode($resources).");");
            }
        );
    }
564525
protected function handle(Event $event): void
    {
        $method = 'apply'.ClassName::short($event);

        if (!method_exists($this, $method)) {
            return;
        }

        $this->$method($event);
    }
979788
public function onPostInstall(Event $event)
    {
        $lockFile = new JsonFile($this->lockFile);
        if ($lockFile->exists()) {
            $this->loadPackages($lockFile);
        } else {
            $this->scanPackages();
        }
        $this->runAction('install');
    }
112328
public function buildFinished(BuildEvent $event)
    {
        $error = $event->getException();
        if ($error === null) {
            $msg = PHP_EOL . $this->getBuildSuccessfulMessage() . PHP_EOL;
        } else {
            $msg = PHP_EOL . $this->getBuildFailedMessage() . PHP_EOL;
            self::throwableMessage($msg, $error, Project::MSG_VERBOSE <= $this->msgOutputLevel);
        }
        $msg .= PHP_EOL . "Total time: " . self::formatTime(Phing::currentTimeMillis() - $this->startTime) . PHP_EOL;

        if ($error === null) {
            $this->printMessage($msg, $this->out, Project::MSG_VERBOSE);
        } else {
            $this->printMessage($msg, $this->err, Project::MSG_ERR);
        }
    }
1313251
public function processFiles($event = null)
    {
        /** @var Model $model */
        $model = $this->owner;
        $ids = [];

        if (in_array($model->scenario, $this->scenarios, true)) {
            $files = UploadedFile::getInstances($model, $this->attribute);

            foreach ($files as $file) {
                $model = $this->uploadFile($file);
                $ids[] = $model->id;
            }

            if (!empty($ids)) {
                $this->owner->{$this->targetAttribute} = implode(',', $ids);
            } else {
                // Protect attribute
                $model->{$this->attribute} = null;
            }
        }
    }
701460
public function addEventToList(Event $event)
    {
        if ($this->_eventList) {
            $this->_eventList->add($event);
        }

        return $this;
    }
1017453
public function onAfterInitialise(Event $event): void
    {
        /** @var WebApplication $app */
        $app = $event['app'];

        // Remove index.php
        if ($app->uri->script === 'index.php') {
            $app->uri->script = null;
        }
    }
256713
public function addEvent(Event $event)
    {
        $this->clear();
        $this->events[$event->getName()] = $event;

        return $this;
    }
919097
public static function buildConfig(Event $event)
    {
        if (true === $event->isDevMode()) {
            $app = new AppKernel('dev', true);
            $app->boot();
            $container = $app->getContainer();
            /**
             * @var ConfigurationProcessorHandler
             */
            $processor = $container->get('bruli.command.bus');

            $processor->handle(new ConfigurationProcessor($event->getIO()));
        }
    }
788437
public function startup($event)
    {
        // startup-event
        $_event = new Event('Component.Manager.startup', $this, [
        ]);
        $this->Controller->eventManager()->dispatch($_event);

        if ($this->isPrefix()) {
            $this->_runCallback("startup", $event);

            // startup-event with Prefix
            $this->_runEvent("startup");
        }
    }
1139900
public function onCreate(CreateResourceEvent $event)
    {
        $request = $this->container->get('request');
        $form = $this->container->get('form.factory')->create(new FileType(true), new File());
        $form->handleRequest($request);

        if ($form->isValid()) {
            $this->handleFileCreation($form, $event);
        }

        $content = $this->container->get('templating')->render(
            'ClarolineCoreBundle:Resource:createForm.html.twig',
            array(
                'form' => $form->createView(),
                'resourceType' => $event->getResourceType()
            )
        );
        $event->setErrorFormContent($content);
        $event->stopPropagation();
    }