From 80896cef2a60e797c584d8fe33eb4c2a90889e21 Mon Sep 17 00:00:00 2001 From: Walter Nasich Date: Mon, 13 Jul 2015 19:47:26 -0300 Subject: [PATCH] Replacing param --locations by boolean flag --no-location --- lib/Cake/Console/Command/Task/ExtractTask.php | 20 +++++-------------- .../Console/Command/Task/ExtractTaskTest.php | 2 +- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/lib/Cake/Console/Command/Task/ExtractTask.php b/lib/Cake/Console/Command/Task/ExtractTask.php index b5d78d23c..578603a20 100644 --- a/lib/Cake/Console/Command/Task/ExtractTask.php +++ b/lib/Cake/Console/Command/Task/ExtractTask.php @@ -48,13 +48,6 @@ class ExtractTask extends AppShell { */ protected $_merge = false; -/** - * Write lines with locations of each message string - * - * @var bool - */ - protected $_locations = true; - /** * Current file being processed * @@ -231,10 +224,6 @@ class ExtractTask extends AppShell { $this->_merge = strtolower($response) === 'y'; } - if (isset($this->params['locations'])) { - $this->_locations = !(strtolower($this->params['locations']) === 'no'); - } - if (empty($this->_files)) { $this->_searchFiles(); } @@ -327,9 +316,10 @@ class ExtractTask extends AppShell { ))->addOption('merge', array( 'help' => __d('cake_console', 'Merge all domain and category strings into the default.po file.'), 'choices' => array('yes', 'no') - ))->addOption('locations', array( - 'help' => __d('cake_console', 'Write lines with locations of each message string'), - 'choices' => array('yes', 'no') + ))->addOption('no-location', array( + 'boolean' => true, + 'default' => false, + 'help' => __d('cake_console', 'Do not write lines with locations'), ))->addOption('output', array( 'help' => __d('cake_console', 'Full path to output directory.') ))->addOption('files', array( @@ -587,7 +577,7 @@ class ExtractTask extends AppShell { foreach ($contexts as $context => $details) { $plural = $details['msgid_plural']; $header = ''; - if ($this->_locations) { + if (empty($this->params['no-location'])) { $files = $details['references']; $occurrences = array(); foreach ($files as $file => $lines) { diff --git a/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php index 9ccf064ce..3374d90a6 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php @@ -233,7 +233,7 @@ class ExtractTaskTest extends CakeTestCase { $this->Task->params['output'] = $this->path . DS; $this->Task->params['extract-core'] = 'no'; $this->Task->params['merge'] = 'no'; - $this->Task->params['locations'] = 'no'; + $this->Task->params['no-location'] = true; $this->Task->expects($this->never())->method('err'); $this->Task->expects($this->any())->method('in')