@param IOInterface $io
@param PhpLint     $phpLint

@return PhpLint
551585
public static function configure(IOInterface $io, PhpLint $phpLint)
    {
        if (true === $phpLint->isUndefined()) {
            $answer = $io->ask(HookQuestions::PHPLINT_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER);
            $phpLint = $phpLint->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($answer)));
        }

        return $phpLint;
    }
201197
private static function createApplication(IOInterface $io, string $config) : Application
    {
        $app = new Application();
        $app->setAutoExit(false);
        $app->setConfigFile($config);
        $app->setProxyIO($io);

        $install = new Install();
        $install->setIO($app->getIO());
        $app->add($install);

        $configuration = new Configuration();
        $configuration->setIO($app->getIO());
        $app->add($configuration);
        return $app;
    }
1024720
public function handle(Args $args, IO $io)
    {
        $path = Path::makeAbsolute($args->getArgument('path'), $this->currentPath);

        $resource = $this->repo->get($path);
        $total = 0;

        $io->writeLine('<c1>'.$resource->getPath().'</c1>');

        $this->printTree($io, $resource, $total);

        $io->writeLine('');
        $io->writeLine($total.' resources');

        return 0;
    }
1109049
public function getIO(InputInterface $input, OutputInterface $output) : IO
    {
        if (null === $this->io) {
            $this->io = new IO\DefaultIO($input, $output, $this->getHelperSet());
        }
        return $this->io;
    }
1225865
public function doRun(InputInterface $input, OutputInterface $output)
    {

        $ioFactory = ConsoleIOFactory::buildDefault($input, $output, $this->getHelperSet());
        $this->io = $ioFactory->get();

        return parent::doRun($input, $output);
    }
967208
public function doRun(InputInterface $input, OutputInterface $output)
	{
		$this->io = new ConsoleIO($input, $output, $this->getHelperSet());
		ErrorHandler::register($this->io);

		return parent::doRun($input, $output);
	}
1232180
public function read($pgt_iou)
    {
        phpCAS::traceBegin();
        $pgt = false;

        // initialize the PDO object for this method
        $pdo = $this->_getPdo();
        $this->_setErrorMode();

        try {
            $pdo->beginTransaction();

            // fetch the pgt for the specified pgt_iou
            $query = $pdo->prepare($this->retrievePgtSql());
            $query->bindValue(':pgt_iou', $pgt_iou, PDO::PARAM_STR);
            $query->execute();
            $pgt = $query->fetchColumn(0);
            $query->closeCursor();

            // delete the specified pgt_iou from the database
            $query = $pdo->prepare($this->deletePgtSql());
            $query->bindValue(':pgt_iou', $pgt_iou, PDO::PARAM_STR);
            $query->execute();
            $query->closeCursor();

            $pdo->commit();
        }
        catch(PDOException $e) {
            // attempt rolling back the transaction before throwing a phpCAS error
            try {
                $pdo->rollBack();
            }
            catch(PDOException $e) {
            }
            phpCAS::trace('error reading PGT from database: ' . $e->getMessage());
        }

        // reset the PDO object
        $this->_resetErrorMode();

        phpCAS::traceEnd();
        return $pgt;
    }
340077
public function EXE(I_O $IO)
    {
        while (true) {
            try {
                if (true === $IO->I_(Type::BOOL)) {
                    return $IO->_O(true);
                }
            } catch (I_O_InputIndexException $e) {
                break;
            }
        }
        return $IO->_O(false);
    }
280584
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $verbosity = PhpVersions::VERBOSITY_NORMAL;
        $verbosity = $input->getOption('verbose') == 2 ? PhpVersions::VERBOSITY_VERBOSE : $verbosity;
        $verbosity = $input->getOption('verbose') == 3 ? PhpVersions::VERBOSITY_DEBUG : $verbosity;
        $verbosity = $input->getOption('quiet') ? PhpVersions::VERBOSITY_SILENT : $verbosity;
        $phpVersions = new PhpVersions(null, $verbosity);

        $versions = $input->getArgument('php');
        $version = array_shift($versions);
        if (empty($version)) {
            $version = 'latest';
        }

        $info = $phpVersions->getInfo($version);

        $format = $input->getOption('format');
        if (empty($format)) {
            $format = 'dump';
        }

        if ($format == 'json') {
            $result = json_encode($info);
        } elseif ($format == 'dump') {
            $result = print_r($info, true);
        } else {
            throw new \RuntimeException("Format '$format' is currently not supported.'");
        }

        $output->writeln($result);
    }
667043
public function execute(Arguments $args, ConsoleIo $io)
    {
        $path = $args->getOption('path') ?: Folder::slashTerm(ROOT) . 'composer.json';

        try {
            is_writable_or_fail($path);
        } catch (Exception $e) {
            $io->err($e->getMessage());
            $this->abort();
        }

        //Gets and decodes the file
        $contents = json_decode(file_get_contents($path), true);

        if (empty($contents)) {
            $io->err(__d('me_tools', 'The file {0} does not seem a valid {1} file', rtr($path), 'composer.json'));
            $this->abort();
        }

        //Checks if the file has been fixed
        if (empty($contents['config']['component-dir']) || $contents['config']['component-dir'] !== 'vendor/components') {
            $contents += ['config' => ['component-dir' => 'vendor/components']];
            create_file($path, json_encode($contents, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
            $io->verbose(__d('me_tools', 'The file {0} has been fixed', rtr($path)));
        } else {
            $io->verbose(__d('me_tools', 'The file {0} doesn\'t need to be fixed', rtr($path)));
        }

        return null;
    }
733350
public function render(IO $io, $indentation = 0)
    {
        $this->alignment->align($io, $indentation);

        foreach ($this->elements as $i => $element) {
            $element->render($io, $this->indentations[$i] + $indentation);
        }

        $this->elements = array();
    }
779494
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $verbosity = PhpVersions::VERBOSITY_NORMAL;
        $verbosity = $input->getOption('verbose') == 2 ? PhpVersions::VERBOSITY_VERBOSE : $verbosity;
        $verbosity = $input->getOption('verbose') == 3 ? PhpVersions::VERBOSITY_DEBUG : $verbosity;
        $verbosity = $input->getOption('quiet') ? PhpVersions::VERBOSITY_SILENT : $verbosity;
        $phpVersions = new PhpVersions(null, $verbosity);

        $versions = $input->getArgument('php');
        $version = array_shift($versions);
        if (empty($version)) {
            $version = 'latest';
        }

        $gpgKeys = [];
        foreach ($phpVersions->getGpgInfo($version) as $key)
        {
            $gpgKeys[] = str_replace(' ', '', $key['pub']);
        }

        $output->write(implode(' ', $gpgKeys));
    }
1361161
protected function init(JobInterface $job, JobGraph $graph, Io\IoDescriptor $io = null)
    {
        $contexts = [];
        $inputs = $this->buildInputs($io);

        foreach ($inputs as $input) {
            $contexts[] = $this->ctxFactory->create($job, $input, $graph->current());
        }

        $msgs = $this->msgFactory->createInitMsgs($contexts);
        foreach ($msgs as $msg) {
            $this->push($msg);
        }
    }
435287
public function execute(Arguments $args, ConsoleIo $io)
    {
        $io->out(Configure::version());

        return static::CODE_SUCCESS;
    }
629769
protected function execute(InputInterface $input, OutputInterface $output)
    {
        // find php
        $phpFinder = new PhpExecutableFinder();
        $phpProcess = $phpFinder->find();

		$fs = new Filesystem();
		$finder = new Finder();
		$finder
			->files()
			->in($input->getArgument('scanDir'))
			->name('*.js')
			->notName('_*')
			->sortByName();

		foreach ($finder as $file) {
			$parser = new \AnalyticsConverter\Parser($file->getContents());
			if (!is_null($input->getOption('mongoDateClass'))) {
				$parser->setMongoDateClass($input->getOption('mongoDateClass'));
			}

			$classGenerator = new \AnalyticsConverter\ClassGenerator(
				$file->getFilename(),
				$parser->parse(),
				$parser->getConditionals(),
				$parser->getConditionalParamMap()
			);

			if (!is_null($input->getOption('classNamespace'))) {
				$classGenerator->setClassNamespace($input->getOption('classNamespace'));
			}

			$targetFileName = $input->getArgument('outDir').'/'.$classGenerator->getName().'.php';

			$fs->dumpFile($targetFileName, $classGenerator->generate());
			$output->writeln("wrote php file '".$targetFileName."'");

			// php lint the file..
            $proc = new Process([$phpProcess, '-l', $targetFileName]);
            $proc->start();
            $proc->wait();

            if ($proc->getExitCode() !== 0) {
                throw new \LogicException(
                    "Invalid PHP code generated in file '".$targetFileName."' - check your pipeline!"
                );
            } else {
                $output->writeln("Checked PHP syntax - all OK!");
            }
		}
    }
1022458
protected function executeLint($linter, $input, $output, $fileCount)
    {
        $cache = !$input->getOption('no-cache');
        $maxColumns = floor((new Terminal())->getWidth() / 2);
        $verbosity = $output->getVerbosity();
        $displayProgress = !$input->getOption('no-progress');

        $displayProgress && $linter->setProcessCallback(function ($status, SplFileInfo $file) use ($output, $verbosity, $fileCount, $maxColumns) {
            static $i = 1;

            $percent = floor(($i / $fileCount) * 100);
            $process = str_pad(" {$i} / {$fileCount} ({$percent}%)", 18, ' ', STR_PAD_LEFT);

            if ($verbosity >= OutputInterface::VERBOSITY_VERBOSE) {
                $filename = str_pad(" {$i}: ".$file->getRelativePathname(), $maxColumns - 10, ' ', \STR_PAD_RIGHT);
                $status = \str_pad(('ok' === $status ? '<info>OK</info>' : '<error>Error</error>'), 20, ' ', \STR_PAD_RIGHT);
                $output->writeln(\sprintf("%s\t%s\t%s", $filename, $status, $process));
            } else {
                if ($i && 0 === $i % $maxColumns) {
                    $output->writeln($process);
                }
                $output->write('ok' === $status ? '<info>.</info>' : '<error>E</error>');
            }
            ++$i;
        });

        $displayProgress || $output->write('<info>Checking...</info>');

        return $linter->lint([], $cache);
    }
1026096
private function listShort(IO $io, ResourceCollection $resources)
    {
        $style = GridStyle::borderless();
        $style->getBorderStyle()->setLineVCChar('  ');
        $grid = new Grid($style);

        foreach ($resources as $resource) {
            $grid->addCell($this->formatName($resource));
        }

        $grid->render($io);
    }