Generate favicons thanks to realfavicon generator.

@param InputInterface  $input
@param OutputInterface $output

@throws \Exception
497515
protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var EntityManager $entityManager */
        $entityManager = $this->getContainer()->get('doctrine.orm.entity_manager');
        /** @var GlobalConfigRepository $globalConfigRepository */
        $globalConfigRepository = $entityManager->getRepository(GlobalConfig::class);

        try {
            if (!$globalConfig = $globalConfigRepository->findLast()) {
                throw new NoResultException();
            }
            $output->writeln('<fg=white;bg=cyan;options=bold>Generating Favicon</>');
            $generator = $this->getContainer()->get(FaviconGenerator::class);
            $files = $generator->generate($globalConfig);
            $output->writeln(sprintf('<comment>%s</comment><info>%s</info>', 'Command line : ', $generator->process->getCommandLine()));
            $output->writeln(sprintf('<info>%s</info>', $generator->process->getOutput()));
            $output->writeln(sprintf('<fg=green>Ok</> The favicons have been generated in <info>%s</info> directory', $generator->target));
            foreach ($files as $file) {
                $output->writeln(sprintf('<comment>- %s</comment>', $file));
            }
        } catch (\Exception $e) {
            $output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
        }
    }
446256
protected function connect(InputInterface $input, OutputInterface $output)
    {
        $input;
        //====================================================================//
        // Perform Connect Test
        $result = Splash::Connect();
        //====================================================================//
        // Output Result
        $output->writeln($result
                ? "<bg=green;fg=white;options=bold>=== SPLASH : CONNECT TEST PASSED </>"
        : "<bg=green;fg=white;options=bold>=== SPLASH : CONNECT TEST PASSED </>");

        $this->ShowLogs($output, $result);
    }
136572
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $start = microtime(true);
        $style = new SymfonyStyle($input, $output);
        $style->setDecorated(true);
        $style->title($this->description);

        $util = new Util();
        $source = $util->checkSource($input);
        if ($input->getOption('diff')) {
            $source = $util->getDiffSource();
        }

        $sources = $this->getAllFiles(explode(' ', $source));
        $exitCode = 0;
        $columnSize = 80;
        $errors = '';
        foreach ($sources as $line => $source) {
            if (($line % $columnSize) == 0) {
                $style->newLine();
            }

            $cmd = 'php -l '.$source;
            $process = new Process($cmd);
            $process->setTimeout(3600)->run(function ($type, $buffer) use ($style, &$errors) {
                if (strpos($buffer, 'No syntax errors') !== false || Process::ERR == $type) {
                    $style->write('.');

                    return;
                }

                $style->write('<error>E</>');
                $errors = $buffer;
            });

            if (!$exitCode) {
                $exitCode = $process->getExitCode();
            }
        }

        $end = microtime(true);
        $time = round($end - $start);

        $style->newLine();
        $output->write($errors);
        $style->newLine();

        $style->section('Results');
        $output->writeln('<info>Command: php -l FILE</>');
        $output->writeln('<info>Files: '.count($sources).'</>');
        $output->writeln('<info>Time: '.$time.' seconds</>');
        $style->newLine();

        return $exitCode;
    }
863939
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $persistence = $this->getPersistence();
        $output->writeln(sprintf(
            'Pulling translations in %s',
            $persistence->getDirectoryName()
        ));

        $gitOutput = $persistence->pullTranslations();
        $output->writeln($gitOutput);

        $output->writeln('Done.');
    }
1370699
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $path = $input->getArgument('path');

        $fileSystem = new FileSystem();
        $fileEditor = new FileEditor(new FileGenerator(), new FunctionRepository(), $fileSystem);

        foreach ($fileSystem->getFilesFromPath($path) as $file) {
            $fileEditor->addBackslashes($file);
        }

        $output->write('Success! Backslashes added!', true);

        return $output;
    }
821227
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = new SymfonyOutput($output);

        $this->input = $input;

        if (method_exists($this, 'handle')) {
            $this->handle();
        }
    }
763607
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new SymfonyStyle($input, $output);

        if ($input->isInteractive() && !$io->confirm('Do you confirm generation?', true)) {
            $io->error('Command aborted');

            return 1;
        }

        foreach (['namespace', 'dir'] as $option) {
            if (null === $input->getOption($option)) {
                throw new RuntimeException(sprintf('The "%s" option must be provided.', $option));
            }
        }

        $namespace = Validators::validateBundleNamespace($input->getOption('namespace'));
        if (!$bundle = $input->getOption('module-name')) {
            $bundle = strtr($namespace, ['\\' => '']);
        }
        $bundle = Validators::validateBundleName($bundle);
        $dir = Validators::validateTargetDir($input->getOption('dir'), $bundle, $namespace);
        if (null === $input->getOption('format')) {
            $input->setOption('format', 'annotation');
        }
        $format = Validators::validateFormat($input->getOption('format'));

        $io->block('Module generation', null, 'bg=blue;fg=white', '  ', true);

        if (!$this->getContainer()->get('filesystem')->isAbsolutePath($dir)) {
            $dir = getcwd().'/'.$dir;
        }

        $io->text('Generating the module code...');
        $generator = $this->getGenerator();
        $generator->generate($namespace, $bundle, $dir, $format);
        $io->success('Code generated!');

        $io->block('You can now start using the generated code!', null, 'bg=blue;fg=white', '  ', true);

        return 0;
    }
10580
protected function execute(InputInterface $input, OutputInterface $output)
	{
		$output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line)
			'MyAdmin DocBlock Parser',
			'=======================',
			''
						 ]);
		$output->writeln('<info>foo</info>'); // green text
		$output->writeln('<comment>foo</comment>'); // yellow text
		$output->writeln('<question>foo</question>'); // black text on a cyan background
		$output->writeln('<error>foo</error>'); // white text on a red background
		$formatter = $this->getHelper('formatter');
		// Section - [SomeSection] Here is some message related to that section
		$formattedLine = $formatter->formatSection('SomeSection', 'Here is some message related to that section');
		$output->writeln($formattedLine);
		// Error Block
		$errorMessages = ['Error!', 'Something went wrong'];
		$formattedBlock = $formatter->formatBlock($errorMessages, 'error');
		$output->writeln($formattedBlock);

		$paths = ['include', 'scripts'];
		$calls = [
			'getFiles'      => ['getHash', 'getSource', 'getNamespaces', 'getIncludes', 'getConstants', 'getFunctions', 'getInterfaces', 'getTraits', 'getPath', 'getDocBlock', 'getName'],
			'getNamespaces' => ['getClasses', 'getConstants', 'getFunctions', 'getInterfaces', 'getTraits', 'getFqsen', 'getName'],
			'getClasses'    => ['isFinal', 'isAbstract', 'getParent', 'getInterfaces', 'getConstants', 'getMethods', 'getProperties', 'getUsedTraits', 'getFqsen', 'getName', 'getDocBlock'],
			'getMethods'    => ['isAbstract', 'isFinal', 'isStatic', 'getVisibility', 'getArguments', 'getFqsen', 'getName', 'getDocBlock'],
			'getProperties' => ['isStatic', 'getDefault', 'getTypes', 'getVisibility', 'getFqsen', 'getName', 'getDocBlock'],
			'getTraits'     => ['getMethods', 'getProperties', 'getUsedTraits', 'getFqsen', 'getName', 'getDocBlock'],
			'getInterfaces' => ['getParents', 'getConstants', 'getMethods', 'getFqsen', 'getName', 'getDocBlock'],
			'getArguments'  => ['isByReference', 'isVariadic', 'getName', 'getTypes', 'getDefault'],
			'getFunctions'  => ['getArguments', 'getFqsen', 'getName', 'getDocBlock'],
			'getConstants'  => ['getValue', 'getFqsen', 'getName', 'getDocBlock']
		];
		/**
		 * @param $parent
		 * @param $call
		 * @param $calls
		 * @return array
		 */
		function do_call($parent, $call, $calls)
		{
			echo "Running \$parent->$call();".PHP_EOL;
			$response = $parent->$call();
			if (isset($calls[$call])) {
				$out = [];
				/** @var \phpDocumentor\Reflection\Php\File $file */
				foreach ($response as $idx => $child) {
					foreach ($calls[$call] as $childCall) {
						/** @var \phpDocumentor\Reflection\Php\File $file */
						$out[$idx] = $childResponse = $child->$childCall();
					}
				}
				echo "Running \$child->$childCall();".PHP_EOL;
				return $out;
			} else {
				return $response;
			}
		}

		$projectFactory = \phpDocumentor\Reflection\Php\ProjectFactory::createInstance();
		$files = [];
		$map = [];
		foreach ($paths as $path) {
			$files[] = new \phpDocumentor\Reflection\File\LocalFile(__DIR__.'/../../../../../'.$path);
		}
		/** @var Project $project */
		$project = $projectFactory->create('MyProject', $files);
		$map = do_call($project, 'getFiles', $calls);
		file_put_contents(__DIR__.'/../../../../../include/config/parse.serial', serialize($map));
		file_put_contents(__DIR__.'/../../../../../include/config/parse.json', json_encode($map, JSON_PRETTY_PRINT));
		/** @var \phpDocumentor\Reflection\Php\Class_ $class */
		/* foreach ($file->getClasses() as $class)
			echo '- ' . $class->getFqsen() . PHP_EOL;
		} */
		/** @var \phpDocumentor\Reflection\Php\Function_ $function */
		/* foreach ($file->getFunctions() as $function) {
			echo '- ' . $function->getFqsen() . PHP_EOL;
		} */

		/** DocBlock / Reflection Parsing
		 * Reconstituting a docblock - https://github.com/phpDocumentor/ReflectionDocBlock/blob/master/examples/03-reconstituting-a-docblock.php
		 * Adding Your own Tag - https://github.com/phpDocumentor/ReflectionDocBlock/blob/master/examples/04-adding-your-own-tag.php
		 */

		/*
		$class = new ReflectionClass('MyClass');
		$phpdoc = new \phpDocumentor\Reflection\DocBlock($class);

		var_dump($phpdoc->getShortDescription());
		var_dump($phpdoc->getLongDescription()->getContents());
		var_dump($phpdoc->getTags());
		var_dump($phpdoc->hasTag('author'));
		var_dump($phpdoc->hasTag('copyright'));
		// But we can also grab all tags of a specific type, such as `see`
		$seeTags = $docblock->getTagsByName('see');

		$reflector = new ReflectionClass('Example');
		// to get the Class DocBlock
		echo $reflector->getDocComment();
		// to get the Method DocBlock
		$reflector->getMethod('fn')->getDocComment();
		*/
	}
862148
public function execute(InputInterface $input, OutputInterface $output)
    {
        if (($name = $input->getArgument('name'))) {
            if ('php' === pathinfo($name, PATHINFO_EXTENSION)) {
                $file = app()->getPath().'/config/'.$name;
                $config = load($file);
                $config = json_encode($config, JSON_PRETTY_PRINT);
            } else {
                $config = config()->get($name, null);
                if (null === $config) {
                    throw new \LogicException(sprintf('Config "%s" is not configure.', $name));
                }

                $config = [$name => $config];
                $config = json_encode($config, JSON_PRETTY_PRINT);
            }

            $output->write('<comment>'.$config.'</comment>');

            return 0;
        }
        $table = new Table($output);
        $rows = [];
        $table->setHeaders(array('File', 'Config', 'Owner', 'Modify At'));

        foreach (glob(app()->getPath().'/config/*') as $file) {
            $file = new FileObject($file);
            $config = load($file->getPathname());
            $count = 0;
            if (is_array($config)) {
                $count = count(array_keys($config));
            }
            $rows[] = [
                $file->getFilename(),
                $count.' Keys',
                posix_getpwuid($file->getOwner())['name'],
                date('Y-m-d H:i:s', $file->getMTime()),
            ];
        }

        $table->setRows($rows);
        $table->render();
    }
815015
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $path = $input->getArgument('path');
        $excludes = $input->getOption('exclude');
        $verbose = $output->getVerbosity();
        $configValue = $this->getUsableConfig($input);

        if ($verbose >= OutputInterface::VERBOSITY_VERBOSE) {
            $this
                ->printInitMessage(
                    $input,
                    $output,
                    $path,
                    $excludes
                );
            $output->writeln('#');
            $output->writeln('# Executing process with this configuration');
            $this->printUsableConfig($output, $configValue);
        }

        $files = $this
            ->loadFiles(
                $path,
                $excludes
            );

        if ($verbose >= OutputInterface::VERBOSITY_VERBOSE) {
            $output->writeln('# Found ' . $files->count() . ' files');
            $output->writeln('# Starting format...');
            $output->writeln('#');
        }

        $fixer = $this->getFixer($configValue);
        $this->fixFiles(
            $input,
            $output,
            $files,
            $fixer
        );
    }
1176625
public function execute(InputInterface $input, OutputInterface $output)
    {
        if (($destPath = $input->getOption('dest-path')) === null) {
            $destPath = 'config';
        }

        if (($author = $input->getArgument('author')) === null) {
            throw new InvalidArgumentException('Missing author option');
        }

        if (($sourceFilePath = $input->getOption('source-file')) === null) {
            $sourceFilePath = 'config/doctrine.php';
        }

        $destPath = realpath($destPath);

        if (!is_dir($destPath)) {
            mkdir($destPath, 0777, true);
        }

        if (!is_writable($destPath)) {
            throw new InvalidArgumentException(
                sprintf("Configuration destination directory '<info>%s</info>' does not have write permissions.",
                    $destPath)
            );
        }

        $destFilePath = $destPath . '/doctrine.generated.php';

        $originalSourceFilePath = $sourceFilePath;
        $sourceFilePath         = realPath($sourceFilePath);

        if (!file_exists($sourceFilePath)) {
            throw new InvalidArgumentException(
                sprintf("Source file at path '<info>%s</info>' does not exist.",
                    $originalSourceFilePath)
            );
        }

        $sourceArrayConfig = include $sourceFilePath;

        $viewFactory = $this->createViewFactory();

        $className = __NAMESPACE__ . '\ConfigMigrations\\' . ucfirst($author) . 'Migrator';

        if (!class_exists($className)) {
            throw new InvalidArgumentException('Author provided was not a valid choice.');
        } else {
            $configMigrator        = new $className($viewFactory);
            $convertedConfigString = $configMigrator->convertConfiguration($sourceArrayConfig);
        }

        file_put_contents($destFilePath, '<?php ' . $convertedConfigString);

        $output->writeln('Conversion successful. File generated at ' . $destFilePath);
    }
159458
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if ($input->getOption('list-info-collectors')) {
            $output->writeln('Available info collectors:', true);
            foreach ($this->systemInfoCollectorRegistry->getIdentifiers() as $identifier) {
                $output->writeln("  $identifier", true);
            }

            return;
        }

        $outputFormatter = $this->outputFormatRegistry->getItem(
            $input->getOption('format')
         );

        if ($input->getArgument('info-collectors')) {
            $identifiers = $input->getArgument('info-collectors');
        } else {
            $identifiers = $this->systemInfoCollectorRegistry->getIdentifiers();
        }

        // Collect info for the given identifiers.
        $collectedInfoArray = [];
        foreach ($identifiers as $identifier) {
            $collectedInfoArray[$identifier] = $this->systemInfoCollectorRegistry->getItem($identifier)->collect();
        }

        $output->writeln(
             $outputFormatter->format($collectedInfoArray)
         );
    }
966996
protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var ConfigurationHelper $configurationHelper */
        $configurationHelper = $this->getHelper('phpdocumentor_configuration');

        $progress = $this->getProgressBar($input);
        if (! $progress) {
            $this->connectOutputToEvents($output);
        }

        // initialize transformer
        $transformer = $this->getTransformer();

        $target = (string) $configurationHelper->getOption($input, 'target', 'transformer/target');
        $fileSystem = new Filesystem();
        if (! $fileSystem->isAbsolutePath($target)) {
            $target = getcwd() . DIRECTORY_SEPARATOR . $target;
        }
        $transformer->setTarget($target);

        $source = realpath($configurationHelper->getOption($input, 'source', 'parser/target'));
        if (!file_exists($source) || !is_dir($source)) {
            throw new \Exception('Invalid source location provided, a path to an existing folder was expected');
        }

        $this->getCache()->getOptions()->setCacheDir($source);

        $projectDescriptor = $this->getBuilder()->getProjectDescriptor();
        $mapper = new ProjectDescriptorMapper($this->getCache());
        $output->writeTimedLog('Load cache', array($mapper, 'populate'), array($projectDescriptor));

        foreach ($this->getTemplates($input) as $template) {
            $output->writeTimedLog(
                'Preparing template "'. $template .'"',
                array($transformer->getTemplates(), 'load'),
                array($template, $transformer)
            );
        }
        $output->writeTimedLog(
            'Preparing ' . count($transformer->getTemplates()->getTransformations()) . ' transformations',
            array($this, 'loadTransformations'),
            array($transformer)
        );

        if ($progress) {
            $progress->start($output, count($transformer->getTemplates()->getTransformations()));
        }

        /** @var CompilerPassInterface $pass */
        foreach ($this->compiler as $pass) {
            $output->writeTimedLog($pass->getDescription(), array($pass, 'execute'), array($projectDescriptor));
        }

        if ($progress) {
            $progress->finish();
        }

        return 0;
    }
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");

        }
495421
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $table = new Table($output);
        $table->setRows([
            ['Classes: ', $this->metrics->classCount($this->dependencies)],
            ['Abstract classes: ', $this->metrics->abstractClassCount($this->dependencies)],
            ['Interfaces: ', $this->metrics->interfaceCount($this->dependencies)],
            ['Traits: ', $this->metrics->traitCount($this->dependencies)],
            ['Abstractness: ', sprintf('%.3f', $this->metrics->abstractness($this->dependencies))],
        ]);
        $table->render();

        $table = new Table($output);
        $table->setHeaders(['', 'Afferent Coupling', 'Efferent Coupling', 'Instability']);
        $table->setRows($this->combineMetrics(
            $this->metrics->afferentCoupling($this->dependencies),
            $this->metrics->efferentCoupling($this->dependencies),
            $this->metrics->instability($this->dependencies)
        ));
        $table->render();
    }
930664
protected function execute(InputInterface $input, OutputInterface $output): void
    {
        $filename = $input->getArgument('filename');

        '@phan-var string $filename';

        $output->writeln("Parsing input file <comment>{$filename}</comment>.");

        $tokens = $this->tokenizer->tokenizeStream($filename);

        $output->write($this->tokenPrinter->printTokenStream($tokens));
    }
922936
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $inputFile = $input->getArgument('input-file');
        $outputFile = $input->getArgument('output-file');

        if ($outputFile === null) {
            $outputFile = preg_replace('/\\.[^.]*$/', '.php', $inputFile);
        }

        $parserGenerator = new ParserGenerator(new PegFile());

        $output = "<?php\n\n" . $parserGenerator->createClass($inputFile);

        file_put_contents($outputFile, $output);
    }