Generate ICO icon

@param OutputInterface $output

@return bool
512450
private function _generateIco(OutputInterface $output)
    {
        $filename = $this->_outputFolder . "favicon.ico";
        $output->writeln("Creating: <info>{$filename}</info>");


        $originalImage = $this->_imagine->open($this->_inputFile)->strip();
        $originalImage->copy()
                ->resize(new \Imagine\Image\Box(16, 16))
                ->save('tmp-16.bmp');

        $icon = $this->_imagine->open('tmp-16.bmp');
        $icon->layers()
                ->add($originalImage->copy()->resize(new \Imagine\Image\Box(32, 32)));

        if ($this->_use48Icon)
        {
            $icon->layers()->add($originalImage->copy()->resize(new \Imagine\Image\Box(48, 48)));
        }
        if ($this->_use64Icon)
        {
            $icon->layers()->add($originalImage->copy()->resize(new \Imagine\Image\Box(64, 64)));
        }

        $icon->save($filename, array(
            'flatten' => false
        ));

        unlink('tmp-16.bmp');
        return true;
    }
588559
protected function createConsoleLogger(OutputInterface $output)
    {
        return new ConsoleLogger(
            $output,
            [
                // aways output notice, info and debug
                LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL,
                LogLevel::INFO   => OutputInterface::VERBOSITY_NORMAL,
                LogLevel::DEBUG  => OutputInterface::VERBOSITY_NORMAL
            ],
            [
                // redirect messages to stderr
                LogLevel::WARNING => ConsoleLogger::INFO,
                LogLevel::NOTICE  => ConsoleLogger::ERROR,
                LogLevel::INFO    => ConsoleLogger::ERROR,
                LogLevel::DEBUG   => ConsoleLogger::ERROR
            ]
        );
    }
888110
protected function getGithubUserNameFromConfig(OutputInterface $output)
    {
        $username = $this->parser->getGitHubUsername();
        if (is_null($username)) {
            $this->showErrorRunLlumInitFirst($output,'username');
        }
        return $username;
    }
1349422
public function runScheduled(OutputInterface $output)
    {
        $success = true;

        $event = new ScheduleRunBeginEvent();
        $this->dispatcher->dispatch($event::NAME, $event);

        foreach ($this->getScheduledJobs() as $jobInfo) {
            $job = $jobInfo['model'];
            $run = $this->runJob($job, $jobInfo, $output);

            $success = $run->succeeded() && $success;
        }

        $event = new ScheduleRunFinishedEvent();
        $this->dispatcher->dispatch($event::NAME, $event);

        return $success;
    }
621660
protected function build(OutputInterface $output)
    {
        $this->command->run($this->input, $output);

        $this->lastBuild = new DateTime();
    }
870319
protected function exportFromCrowdin(InputInterface $input, OutputInterface $output)
    {
        $command = $this->getApplication()->find('crowdin:api:export');
        $arguments = array(
            'command' => 'crowdin:api:export'
        );
        $input = new ArrayInput($arguments);

        return $command->run($input, $output);
    }
192705
protected function execute(InputInterface $input, OutputInterface $output)
    {
        // Get the current version or generate a new one if the user has confirm that this is required
        try {
            $currentVersion = Context::get('version-persister')->getCurrentVersion();
        } catch (\Liip\RMT\Exception\NoReleaseFoundException $e) {
            if (Context::get('information-collector')->getValueFor('confirm-first') == false) {
                throw $e;
            }
            $currentVersion = Context::get('version-generator')->getInitialVersion();
        }
        Context::getInstance()->setParameter('current-version', $currentVersion);

        // Generate and save the new version number
        $newVersion = Context::get('version-generator')->generateNextVersion(
            Context::getParam('current-version')
        );
        Context::getInstance()->setParameter('new-version', $newVersion);

        $this->executeActionListIfExist('pre-release-actions');

        $this->getOutput()->writeSmallTitle('Release process');
        $this->getOutput()->indent();

        $this->getOutput()->writeln("A new version named [<yellow>$newVersion</yellow>] is going to be released");
        Context::get('version-persister')->save($newVersion);
        $this->getOutput()->writeln('Release: <green>Success</green>');

        $this->getOutput()->unIndent();

        $this->executeActionListIfExist('post-release-actions');
    }
673309
protected function getTable(OutputInterface $output)
    {
        if (!\class_exists('Symfony\Component\Console\Helper\Table')) {
            return $this->getTableHelper();
        }

        $style = new TableStyle();
        $style
            ->setVerticalBorderChar(' ')
            ->setHorizontalBorderChar('')
            ->setCrossingChar('');

        $table = new Table($output);

        return $table
            ->setRows([])
            ->setStyle($style);
    }
1260967
public static function getInstance(OutputInterface $output, InputInterface $input)
    {
        $questionHelper = new QuestionHelper();
        $application    = new Application('Code Generator Command Line Interface', 'Alpha');
        $application->getHelperSet()->set(new FormatterHelper(), 'formatter');
        $application->getHelperSet()->set($questionHelper, 'question');

        $context = new CliContext(
            $questionHelper,
            $output,
            $input,
            CreateCommandFactory::getInstance($application)
        );

        $mainBackbone = MainBackboneFactory::getInstance($context);

        $mainBackbone->run();

        return $application;
    }
262992
protected function installAssets(OutputInterface $output)
    {
        $webDir = $this->getContainer()->getParameter('kernel.root_dir') . '/../web';
        $command = $this->getApplication()->find('assets:install');
        $input = new ArrayInput(
            array(
                'command' => 'assets:install',
                'target' => realpath($webDir),
                '--symlink' => true
            )
        );
        $command->run($input, $output);
    }
441539
protected function finishCommand(OutputInterface $output)
    {
        $event = $this->stopStopWatch('command');
        $this
            ->printMessage(
                $output,
                $this->getProjectHeader(),
                'Command finished in ' . $event->getDuration() . ' milliseconds'
            );
        $this->printMessage(
                $output,
                $this->getProjectHeader(),
                'Max memory used: ' . $event->getMemory() . ' bytes'
            );
        $output->writeln('');
    }
42020
protected function reconcileInitialConfig(OutputInterface $output)
    {
        $this->step(++$this->step, 'Basic configuration');
        $settings = $this->displayConfigTable();
        $confirm = $this->io->confirm('Would you like to edit these now?', false);
        if ($confirm === false) {
            return true;
        }
        $command = $this->getApplication()->find('config:set');
        $buffer = $this->getBufferedOutput($output, OutputInterface::VERBOSITY_NORMAL);

        $siteName = $this->io->ask('Site name:', $settings['sitename']);
        $sitePayoff = $this->io->ask('Site payoff tag-line:', $settings['payoff']);
        $theme = $this->io->ask('Theme name:', $settings['theme'], function ($v) use ($settings) {
            $fs = $this->app['filesystem']->getFilesystem('themes');
            if ($fs->has($v)) {
                return $v;
            }
            $this->io->warning(sprintf('The theme directory "%s" was not found, reverting to "%s"', $v, $settings['theme']));

            return $settings['theme'];
        });
        $debug = $this->io->confirm('Enable debugging:', $settings['debug']);
        $settings = [
            'sitename' => $siteName,
            'payoff'   => $sitePayoff,
            'theme'    => $theme,
            'debug'    => $debug,
        ];
        foreach ($settings as $key => $value) {
            $input = new ArrayInput([
                '--no-interaction' => true,
                'key'              => $key,
                'value'            => $value,
            ]);

            $result = $command->run($input, $buffer);
            $this->writeBufferedOutput($buffer, $result);
        }

        $this->io->success('Settings updated!');
        $this->displayConfigTable();
        if ($debug) {
            $this->io->block('Do not forget to disable debugging for production', 'REMINDER', 'fg=yellow', ' ! ');
        }

        return true;
    }
536208
public static function display(OutputInterface $output, $instance)
    {
        $ref = new \ReflectionClass($instance);
        $methods = $ref->getMethods(\ReflectionMethod::IS_PUBLIC);
        $table = new Table($output);
        $table->setStyle('compact');

        foreach ($methods as $method) {
            $methodName = $method->getName();

            if (preg_match('/^get|has|is/', $methodName) && 0 === $method->getNumberOfParameters()) {
                $value = static::getFieldValue($instance, $methodName);
                $methodName = preg_match('/^get/', $methodName) ? substr($methodName, 3) : $methodName;
                $table->addRow(['<comment>'.static::humanize($methodName).'</comment>', ': '.$value]);
            }
        }

        $table->render();
    }
571362
private function createDB(OutputInterface $output)
    {
        $output->write('> Loading the schema of the DB', true);

        $arguments = [
            'command' => 'doctrine:schema:update',
            '--force' => true,
        ];

        $input = new ArrayInput($arguments);

        return $this->getApplication()->run($input);
    }
601942
protected function execute(InputInterface $input, OutputInterface $output)
        {
            $aData = array();
            // set colors and formats
            $oErrStyle  = new OutputFormatterStyle('red', null, array('bold'));
            $oOkStyle   = new OutputFormatterStyle('green', null, array('bold'));
            $oLogoStyle = new OutputFormatterStyle('cyan', null);
            $output->getFormatter()->setStyle('err', $oErrStyle);
            $output->getFormatter()->setStyle('ok', $oOkStyle);
            $output->getFormatter()->setStyle('sw', $oLogoStyle);

            // print logo
            $this->_printLogo($output);


            // Get active remote apps
            $aRemoteApps = RemoteAppQuery::create()->findByActivated(true);
            /** @var RemoteApp $oRemoteApp */
            $iCnt       = 0;
            foreach ($aRemoteApps as $oRemoteApp) {
                // get cron string
                $aData[] = array(
                    $oRemoteApp->getId(),
                    $oRemoteApp->getName(),
                    $oRemoteApp->getLastRun()->format("d.m.Y H:i:s"),
                );
                $iCnt++;
            }

            // get tablehelper for cli
            $oTable = $this->getHelper('table');
            $oTable
                ->setHeaders(array('ID', 'Title', 'Lastrun'))
                ->setRows($aData)
            ;
            $oTable->render($output);

            // green text
            $output->writeln("\n<fg=white;options=bold>     " . $iCnt . " Job(s) found</fg=white;options=bold>\n");

        }
640325
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->injectOutputIntoLogger($output, $this->logger);
        $output->writeln($this->crypt->generateKey());
        return 0;
    }
962488
protected function initialize(InputInterface $input, OutputInterface $output)
    {
        $styles = [
            // ---------------------------------------
            // Style    => [ Color, BgColor, Options ]
            // ---------------------------------------
            'title'     => [ 'white', null, ['bold'] ],
            'info'      => [ 'cyan' ],
            'warn'      => [ 'yellow', null, ['bold'] ],
            'erro'      => [ 'red', null, ['bold'] ],
            'success'   => [ 'green' ],
            'failure'   => [ 'yellow' ],
            'label'     => [ 'cyan', null, ['underscore'] ],
            'comment'   => [ 'white', null, ['reverse'] ],
            'highlight' => [ 'yellow' ],
        ];

        foreach ($styles as $name => $style) {
            $output->getFormatter()->setStyle(
                $name,
                Reflection::newInstance(
                    OutputFormatterStyle::class,
                    $style
                )
            );
        }

        $this->output = new OutputStyle($input, $output);
    }