本文整理匯總了PHP中Symfony\Component\Console\Output\OutputInterface::isQuiet方法的典型用法代碼示例。如果您正苦於以下問題:PHP OutputInterface::isQuiet方法的具體用法?PHP OutputInterface::isQuiet怎麽用?PHP OutputInterface::isQuiet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Console\Output\OutputInterface
的用法示例。
在下文中一共展示了OutputInterface::isQuiet方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$config = $input->getArgument('config');
if ($config) {
try {
$this->loadConfig($config);
} catch (\Exception $e) {
if (!$output->isQuiet()) {
$output->writeln(sprintf("Failed to load config: %s", $e->getMessage()));
}
exit(1);
}
}
if (empty($this->config)) {
if (!$output->isQuiet()) {
$output->writeln("No configuration found.");
}
exit(1);
}
try {
$params = array('version' => $this->config->getVersion(), 'region' => $this->config->getRegion(), 'credentials' => array('key' => $this->config->getCredentials()->getKey(), 'secret' => $this->config->getCredentials()->getSecret()));
if ($this->config->getTimeout() !== NULL) {
$params['http']['timeout'] = $this->config->getTimeout();
}
$client = new S3Client($params);
} catch (\Exception $e) {
if (!$output->isQuiet()) {
$output->writeln("Failed to connect to AWS.");
}
exit(1);
}
foreach ($this->config->getBuckets() as $bucket) {
// Make sure the Bucket's destination is writable.
$destination = $bucket->getDestination();
if (!is_writable($destination)) {
$output->writeln(sprintf('Failed to write to destination "%s".', $destination));
exit(1);
}
if ($bucket->getObjects()) {
try {
$this->fetchBucketByObjects($bucket, $client);
} catch (\Exception $e) {
if ($output->isVerbose()) {
$output->writeln(sprintf('An error occured fetching Bucket "%s": %s', $bucket->getName(), $e->getMessage()));
}
}
} else {
try {
$this->fetchBucketByLimit($bucket, $client);
} catch (\Exception $e) {
if ($output->isVerbose()) {
$output->writeln(sprintf('An error occured fetching Bucket "%s": %s', $bucket->getName(), $e->getMessage()));
}
}
}
}
return true;
}
示例2: runQueriesFromFile
protected function runQueriesFromFile($file)
{
$queries = array_filter(preg_split('(;\\s*$)m', file_get_contents($file)));
if (!$this->output->isQuiet()) {
$this->output->writeln(sprintf("Executing %d queries from %s on database %s", count($queries), $file, $this->db->getDatabase()));
}
foreach ($queries as $query) {
$this->db->exec($query);
}
}
示例3: execute
protected function execute(InputInterface $input, OutputInterface $output) : int
{
if (!$output->isQuiet()) {
$output->writeln($this->getApplication()->getLongVersion());
}
$composerJson = $input->getArgument('composer-json');
$this->checkJsonFile($composerJson);
$getPackageSourceFiles = new LocateComposerPackageSourceFiles();
$sourcesASTs = new LocateASTFromFiles((new ParserFactory())->create(ParserFactory::PREFER_PHP7));
$definedVendorSymbols = (new LocateDefinedSymbolsFromASTRoots())->__invoke($sourcesASTs((new ComposeGenerators())->__invoke($getPackageSourceFiles($composerJson), (new LocateComposerPackageDirectDependenciesSourceFiles())->__invoke($composerJson))));
$options = $this->getCheckOptions($input);
$definedExtensionSymbols = (new LocateDefinedSymbolsFromExtensions())->__invoke((new DefinedExtensionsResolver())->__invoke($composerJson, $options->getPhpCoreExtensions()));
$usedSymbols = (new LocateUsedSymbolsFromASTRoots())->__invoke($sourcesASTs($getPackageSourceFiles($composerJson)));
$unknownSymbols = array_diff($usedSymbols, $definedVendorSymbols, $definedExtensionSymbols, $options->getSymbolWhitelist());
if (!$unknownSymbols) {
$output->writeln("There were no unknown symbols found.");
return 0;
}
$output->writeln("The following unknown symbols were found:");
$table = new Table($output);
$table->setHeaders(['unknown symbol', 'guessed dependency']);
$guesser = new DependencyGuesser();
foreach ($unknownSymbols as $unknownSymbol) {
$guessedDependencies = [];
foreach ($guesser($unknownSymbol) as $guessedDependency) {
$guessedDependencies[] = $guessedDependency;
}
$table->addRow([$unknownSymbol, implode("\n", $guessedDependencies)]);
}
$table->render();
return (int) (bool) $unknownSymbols;
}
示例4: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$roles = Util::assumedRoles();
if (!$output->isQuiet()) {
dump($roles);
}
return $roles;
}
示例5: renderOutput
/**
* Render output.
*
* @param string $type
* @param string $message
*
* @return void
*/
protected function renderOutput($type, $message)
{
if ($this->output->isQuiet()) {
return;
}
if (Process::ERR === $type) {
$message = sprintf('<error>%s</error>', $message);
}
$this->output->writeln($message);
}
示例6: toUnfollow
public function toUnfollow(InputInterface $input, OutputInterface $output)
{
$followers = $this->api->followersIds($this->username);
$followings = $this->api->followingsIds($this->username);
$toUnfollow = array_values(array_diff($followings, $followers));
if (!$output->isQuiet()) {
$this->info(sprintf("Stats %s:\t Following %s\t Followers %s", $this->username, count($followings), count($followers)));
$this->info(sprintf("Followings not following back: %s", count($toUnfollow)));
}
echo json_encode($toUnfollow, JSON_PRETTY_PRINT) . PHP_EOL;
}
示例7: fire
protected function fire(InputInterface $input, OutputInterface $output)
{
$usernames = $input->getArgument('usernames');
$api = new Api();
foreach ($usernames as $username) {
$followers = $api->followersIds($username);
$followings = $api->followingsIds($username);
$this->db->relationships->insert(array('username' => $username, 'time' => new MongoDate(), 'followers' => $followers, 'followings' => $followings));
if (!$output->isQuiet()) {
$this->info(sprintf("Synced %s:\t Following %s\t Followers %s", $username, count($followings), count($followers)));
}
}
}
示例8: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$result = Reporter::UNKNOWN;
$paths = $input->getArgument('path');
foreach ($paths as $path) {
if (is_file($path)) {
$result = $this->lintFile($path, $input->getOption('types'));
} else {
$result = $this->lintDirectory($path, $input->getOption('types'), $input->getOption('ignore'));
}
}
if (!$output->isQuiet()) {
$output->writeln(array('', sprintf('<bg=%s>%-' . (reset($this->getApplication()->getTerminalDimensions()) - 1) . 's</>', $result === Reporter::SUCCESS ? 'green' : 'red', $result === Reporter::SUCCESS ? ' [OK] All documents are perfect!' : ' [ERROR] Sorry, some errors were found')));
}
return $result > -1 ? $result : 3;
}
示例9: computeLogThreshold
public function computeLogThreshold(OutputInterface $output)
{
if ($output->isDebug()) {
return Logger::DEBUG;
}
if ($output->isVeryVerbose()) {
return Logger::INFO;
}
if ($output->isVerbose()) {
return Logger::INFO;
}
if ($output->isQuiet()) {
return \PHP_INT_MAX;
}
return Logger::WARNING;
}
示例10: isQuiet
/**
* Returns whether verbosity is quiet (-q).
*
* @return bool
*/
public function isQuiet()
{
return $this->output->isQuiet();
}
示例11: isQuiet
/**
* Returns whether verbosity is quiet (-q).
*
* @return bool true if verbosity is set to VERBOSITY_QUIET, false otherwise
*/
public function isQuiet()
{
return $this->decoratedOutput->isQuiet();
}
示例12: execute
/**
* @param InputInterface $input
* @param OutputInterface|Output $output
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->getLogger()->debug('Start', ['command_name' => $this->getName(), 'args' => $input->getArguments(), 'opts' => $input->getOptions()]);
$action = $input->getArgument('action');
if (!in_array($action, [self::ACTION_INIT, self::ACTION_DROP])) {
throw new \RuntimeException(sprintf('Invalid argument action, must be "%s" or "%s"', self::ACTION_INIT, self::ACTION_DROP));
}
$optionDryRun = $input->getOption('dry-run');
$prettyOutput = !$output->isQuiet() && !$output->isDebug();
if ($prettyOutput) {
$this->getSymfonyStyle()->title(sprintf('grumphp action "%s"', $input->getArgument('action')));
$this->getSymfonyStyle()->writeln('');
}
$repositories = $this->getRepositoryModelList();
$composerFilename = $repositories->getProjectModel()->getAbsolutePath() . DIRECTORY_SEPARATOR . 'composer.json';
$composerData = json_decode(file_get_contents($composerFilename), true);
if (!$composerData) {
throw new \RuntimeException('Json decode error: ' . json_last_error_msg());
}
$configFilename = $repositories->getProjectModel()->getAbsolutePath() . DIRECTORY_SEPARATOR . 'grumphp.yml';
if (!empty($composerData['config']['extra']['grumphp']['config-default-path'])) {
$configFilename = $composerData['config']['extra']['grumphp']['config-default-path'];
}
if (!file_exists($configFilename)) {
$this->getSymfonyStyle()->error(sprintf('File "%s" not found', $configFilename));
return;
}
if ($prettyOutput) {
$this->getSymfonyStyle()->write(sprintf('Work with GrumPhp file "%s"', $configFilename));
}
$grumpConfigData = Yaml::parse(file_get_contents($configFilename));
$fileSystem = new Filesystem();
$vendorModels = $repositories->getVendorModels();
$vendorModelsCnt = count($vendorModels);
$progress = null;
if ($prettyOutput) {
$progress = new ProgressBar($output, $vendorModelsCnt);
$progress->setFormat("%filename% \n %current%/%max% [%bar%]\n");
$progress->setBarCharacter('<comment>#</comment>');
$progress->setEmptyBarCharacter(' ');
$progress->setProgressCharacter('');
$progress->setBarWidth(50);
}
foreach ($vendorModels as $model) {
if ($prettyOutput) {
$progress->setMessage('Working on ' . $model->getPath(), 'filename');
$progress->advance();
}
$vendorPath = $model->getAbsolutePath();
$gitPreCommitFilename = implode(DIRECTORY_SEPARATOR, [$vendorPath, '.git', 'hooks', 'pre-commit']);
$gitCommitMsgFilename = implode(DIRECTORY_SEPARATOR, [$vendorPath, '.git', 'hooks', 'commit-msg']);
$vendorConfigFilename = implode(DIRECTORY_SEPARATOR, [$vendorPath, '.git', 'grumphp.yml']);
if (self::ACTION_INIT == $action) {
$grumpConfigData['parameters']['bin_dir'] = '../../../bin';
if (!empty($grumpConfigData['parameters']['tasks']['phpcs']['standard'])) {
$standard = $grumpConfigData['parameters']['tasks']['phpcs']['standard'];
if (0 === strpos($standard, 'vendor/') || 0 === strpos($standard, './vendor/')) {
$grumpConfigData['parameters']['tasks']['phpcs']['standard'] = implode(DIRECTORY_SEPARATOR, [$repositories->getProjectModel()->getAbsolutePath(), $grumpConfigData['parameters']['tasks']['phpcs']['standard']]);
}
}
if (!$optionDryRun) {
$grumpConfigYml = Yaml::dump($grumpConfigData);
$fileSystem->dumpFile($vendorConfigFilename, $grumpConfigYml);
$fileSystem->dumpFile($gitPreCommitFilename, $this->generatePreCommit($vendorConfigFilename));
$fileSystem->chmod($gitPreCommitFilename, 0755);
$fileSystem->dumpFile($gitCommitMsgFilename, $this->generateCommitMsg($vendorConfigFilename));
$fileSystem->chmod($gitCommitMsgFilename, 0755);
}
$this->getLogger()->debug('Config created', ['file' => $vendorConfigFilename]);
$this->getLogger()->debug('Pre commit hook created', ['file' => $gitPreCommitFilename]);
$this->getLogger()->debug('Commit msg hook created', ['file' => $gitCommitMsgFilename]);
} elseif (self::ACTION_DROP == $action) {
if (!$optionDryRun) {
$fileSystem->remove([$gitCommitMsgFilename, $gitPreCommitFilename, $vendorConfigFilename]);
}
$this->getLogger()->debug('Config removed', ['file' => $vendorConfigFilename]);
$this->getLogger()->debug('Pre commit hook removed', ['file' => $gitPreCommitFilename]);
$this->getLogger()->debug('Commit msg hook removed', ['file' => $gitCommitMsgFilename]);
}
}
if ($prettyOutput) {
$progress->setMessage('Done', 'filename');
$progress->finish();
if (self::ACTION_INIT == $action) {
$this->getSymfonyStyle()->success('GrumPHP is sniffing your vendors code!');
} elseif (self::ACTION_DROP == $action) {
$this->getSymfonyStyle()->note('GrumPHP stopped sniffing your vendors commits! Too bad ...');
}
}
$this->getLogger()->debug('Finish', ['command_name' => $this->getName()]);
}
示例13: printNoAwlError
/**
* @param OutputInterface $output
* @param $source
*/
protected function printNoAwlError(OutputInterface $output, $source)
{
if (!$output->isQuiet()) {
$output->writeln(sprintf('<error>No .awl files found in %s</error>', $source));
$output->writeln('');
}
}