Skip to content

Commit

Permalink
Convert to ProgressBar in symfony/console ^2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
giggsey committed Jan 27, 2016
1 parent 9cc3157 commit 5cc3fa5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
Expand Up @@ -5,7 +5,6 @@

use libphonenumber\buildtools\GeneratePhonePrefixData;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -26,14 +25,11 @@ protected function configure()

protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var ProgressHelper $progress */
$progress = $this->getHelperSet()->get('progress');
$generatePhonePrefixData = new GeneratePhonePrefixData();
$generatePhonePrefixData->start(
$input->getArgument('InputDirectory'),
$input->getArgument('OutputDirectory'),
$output,
$progress
$output
);
}
}
8 changes: 5 additions & 3 deletions build/libphonenumber/buildtools/GeneratePhonePrefixData.php
Expand Up @@ -2,7 +2,7 @@

namespace libphonenumber\buildtools;

use Symfony\Component\Console\Helper\ProgressHelper;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\OutputInterface;

class GeneratePhonePrefixData
Expand All @@ -27,7 +27,7 @@ class GeneratePhonePrefixData
*/
private static $consoleOutput;

public function start($inputDir, $outputDir, OutputInterface $consoleOutput, ProgressHelper $progress)
public function start($inputDir, $outputDir, OutputInterface $consoleOutput)
{
$this->inputDir = $inputDir;
$this->outputDir = $outputDir;
Expand All @@ -36,7 +36,9 @@ public function start($inputDir, $outputDir, OutputInterface $consoleOutput, Pro
$inputOutputMappings = $this->createInputOutputMappings();
$availableDataFiles = array();

$progress->start($consoleOutput, count($inputOutputMappings));
$progress = new ProgressBar($consoleOutput, count($inputOutputMappings));

$progress->start();
foreach ($inputOutputMappings as $textFile => $outputFiles) {
$mappings = $this->readMappingsFromFile($textFile);

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -38,9 +38,9 @@
"phing/phing": "~2.7",
"pear/versioncontrol_git": "dev-master",
"pear/pear-core-minimal": "^1.9",
"pear/pear_exception": "*",
"pear/pear_exception": "^1.0",
"phpunit/phpunit": "~4.0",
"symfony/console": "~2.4",
"symfony/console": "^2.5",
"satooshi/php-coveralls": "~0.6"
},
"suggest": {
Expand Down

0 comments on commit 5cc3fa5

Please sign in to comment.