本文整理汇总了PHP中Output::writeln方法的典型用法代码示例。如果您正苦于以下问题:PHP Output::writeln方法的具体用法?PHP Output::writeln怎么用?PHP Output::writeln使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output
的用法示例。
在下文中一共展示了Output::writeln方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: analyze
/**
* @param array $files
*/
public function analyze(array $files)
{
$this->output->writeln('Got ' . count($files) . ' files');
$this->output->writeln('Collect entities...');
$this->classScanner->parseFilesForClassesAndInterfaces($files);
$this->definedEntities = $this->classScanner->getDefinedEntities();
$this->output->writeln('Got ' . count($this->definedEntities) . ' defined entities');
$this->output->writeln('Check namespaces...');
$progressbar = new Progressbar($this->output, count($files));
foreach ($files as $file) {
$this->analyzeFile($file);
$progressbar->step();
}
}
示例2: doDump
/**
* Write the data out to a file
*
* @param string $data The data to write
* @param Output $output
*/
private function doDump($data, $output)
{
if (!is_dir($dir = dirname($this->targetPath))) {
$output->writeln('<info>[dir+]</info> ' . $dir);
if (false === @mkdir($dir, 0777, true)) {
throw new \RuntimeException('Unable to create directory ' . $dir);
}
}
$output->writeln('<info>[file+]</info> ' . $this->targetPath);
if (false === @file_put_contents($this->targetPath, $data)) {
throw new \RuntimeException('Unable to write file ' . $this->targetPath);
}
$output->writeln('<info>Output written into ' . $this->targetPath . '</info>');
}
示例3: getConfiguration
/**
* get configration object for migration script
*
* This is based on antromattr/mongodb-migartion code but extends it so we can inject
* non local stuff centrally.
*
* @param string $filepath path to configuration file
* @param Output $output ouput interface need by config parser to do stuff
*
* @return AntiMattr\MongoDB\Migrations\Configuration\Configuration
*/
private function getConfiguration($filepath, $output)
{
$outputWriter = new OutputWriter(function ($message) use($output) {
return $output->writeln($message);
});
$info = pathinfo($filepath);
$namespace = 'AntiMattr\\MongoDB\\Migrations\\Configuration';
$class = $info['extension'] === 'xml' ? 'XmlConfiguration' : 'YamlConfiguration';
$class = sprintf('%s\\%s', $namespace, $class);
$configuration = new $class($this->documentManager->getDocumentManager()->getConnection(), $outputWriter);
// register databsae name before loading to ensure that loading does not fail
$configuration->setMigrationsDatabaseName($this->databaseName);
// load additional config from migrations.(yml|xml)
$configuration->load($filepath);
return $configuration;
}