Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f693ab3

Browse filesBrowse files
committed
Rename viewPaths to codePaths
1 parent ce09f56 commit f693ab3
Copy full SHA for f693ab3

File tree

4 files changed

+25
-25
lines changed
Filter options

4 files changed

+25
-25
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
+11-11Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ class TranslationDebugCommand extends Command
5555
private $defaultTransPath;
5656
private $defaultViewsPath;
5757
private $transPaths;
58-
private $viewsPaths;
58+
private $codePaths;
5959

60-
public function __construct(TranslatorInterface $translator, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultTransPath = null, string $defaultViewsPath = null, array $transPaths = [], array $viewsPaths = [])
60+
public function __construct(TranslatorInterface $translator, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultTransPath = null, string $defaultViewsPath = null, array $transPaths = [], array $codePaths = [])
6161
{
6262
parent::__construct();
6363

@@ -67,7 +67,7 @@ public function __construct(TranslatorInterface $translator, TranslationReaderIn
6767
$this->defaultTransPath = $defaultTransPath;
6868
$this->defaultViewsPath = $defaultViewsPath;
6969
$this->transPaths = $transPaths;
70-
$this->viewsPaths = $viewsPaths;
70+
$this->codePaths = $codePaths;
7171
}
7272

7373
/**
@@ -139,10 +139,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
139139
if ($this->defaultTransPath) {
140140
$transPaths[] = $this->defaultTransPath;
141141
}
142-
$viewsPaths = $this->viewsPaths;
143-
$viewsPaths[] = $kernel->getProjectDir().'/src';
142+
$codePaths = $this->codePaths;
143+
$codePaths[] = $kernel->getProjectDir().'/src';
144144
if ($this->defaultViewsPath) {
145-
$viewsPaths[] = $this->defaultViewsPath;
145+
$codePaths[] = $this->defaultViewsPath;
146146
}
147147

148148
// Override with provided Bundle info
@@ -151,19 +151,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int
151151
$bundle = $kernel->getBundle($input->getArgument('bundle'));
152152
$bundleDir = $bundle->getPath();
153153
$transPaths = [is_dir($bundleDir.'/Resources/translations') ? $bundleDir.'/Resources/translations' : $bundleDir.'/translations'];
154-
$viewsPaths = [is_dir($bundleDir.'/Resources/views') ? $bundleDir.'/Resources/views' : $bundleDir.'/templates'];
154+
$codePaths = [is_dir($bundleDir.'/Resources/views') ? $bundleDir.'/Resources/views' : $bundleDir.'/templates'];
155155
if ($this->defaultTransPath) {
156156
$transPaths[] = $this->defaultTransPath;
157157
}
158158
if ($this->defaultViewsPath) {
159-
$viewsPaths[] = $this->defaultViewsPath;
159+
$codePaths[] = $this->defaultViewsPath;
160160
}
161161
} catch (\InvalidArgumentException $e) {
162162
// such a bundle does not exist, so treat the argument as path
163163
$path = $input->getArgument('bundle');
164164

165165
$transPaths = [$path.'/translations'];
166-
$viewsPaths = [$path.'/templates'];
166+
$codePaths = [$path.'/templates'];
167167

168168
if (!is_dir($transPaths[0]) && !isset($transPaths[1])) {
169169
throw new InvalidArgumentException(sprintf('"%s" is neither an enabled bundle nor a directory.', $transPaths[0]));
@@ -173,12 +173,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
173173
foreach ($kernel->getBundles() as $bundle) {
174174
$bundleDir = $bundle->getPath();
175175
$transPaths[] = is_dir($bundleDir.'/Resources/translations') ? $bundleDir.'/Resources/translations' : $bundle->getPath().'/translations';
176-
$viewsPaths[] = is_dir($bundleDir.'/Resources/views') ? $bundleDir.'/Resources/views' : $bundle->getPath().'/templates';
176+
$codePaths[] = is_dir($bundleDir.'/Resources/views') ? $bundleDir.'/Resources/views' : $bundle->getPath().'/templates';
177177
}
178178
}
179179

180180
// Extract used messages
181-
$extractedCatalogue = $this->extractMessages($locale, $viewsPaths);
181+
$extractedCatalogue = $this->extractMessages($locale, $codePaths);
182182

183183
// Load defined messages
184184
$currentCatalogue = $this->loadCurrentMessages($locale, $transPaths);

‎src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ class TranslationUpdateCommand extends Command
5151
private $defaultTransPath;
5252
private $defaultViewsPath;
5353
private $transPaths;
54-
private $viewsPaths;
54+
private $codePaths;
5555

56-
public function __construct(TranslationWriterInterface $writer, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultLocale, string $defaultTransPath = null, string $defaultViewsPath = null, array $transPaths = [], array $viewsPaths = [])
56+
public function __construct(TranslationWriterInterface $writer, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultLocale, string $defaultTransPath = null, string $defaultViewsPath = null, array $transPaths = [], array $codePaths = [])
5757
{
5858
parent::__construct();
5959

@@ -64,7 +64,7 @@ public function __construct(TranslationWriterInterface $writer, TranslationReade
6464
$this->defaultTransPath = $defaultTransPath;
6565
$this->defaultViewsPath = $defaultViewsPath;
6666
$this->transPaths = $transPaths;
67-
$this->viewsPaths = $viewsPaths;
67+
$this->codePaths = $codePaths;
6868
}
6969

7070
/**
@@ -150,10 +150,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
150150
if ($this->defaultTransPath) {
151151
$transPaths[] = $this->defaultTransPath;
152152
}
153-
$viewsPaths = $this->viewsPaths;
154-
$viewsPaths[] = $kernel->getProjectDir().'/src';
153+
$codePaths = $this->codePaths;
154+
$codePaths[] = $kernel->getProjectDir().'/src';
155155
if ($this->defaultViewsPath) {
156-
$viewsPaths[] = $this->defaultViewsPath;
156+
$codePaths[] = $this->defaultViewsPath;
157157
}
158158
$currentName = 'default directory';
159159

@@ -163,20 +163,20 @@ protected function execute(InputInterface $input, OutputInterface $output): int
163163
$foundBundle = $kernel->getBundle($input->getArgument('bundle'));
164164
$bundleDir = $foundBundle->getPath();
165165
$transPaths = [is_dir($bundleDir.'/Resources/translations') ? $bundleDir.'/Resources/translations' : $bundleDir.'/translations'];
166-
$viewsPaths = [is_dir($bundleDir.'/Resources/views') ? $bundleDir.'/Resources/views' : $bundleDir.'/templates'];
166+
$codePaths = [is_dir($bundleDir.'/Resources/views') ? $bundleDir.'/Resources/views' : $bundleDir.'/templates'];
167167
if ($this->defaultTransPath) {
168168
$transPaths[] = $this->defaultTransPath;
169169
}
170170
if ($this->defaultViewsPath) {
171-
$viewsPaths[] = $this->defaultViewsPath;
171+
$codePaths[] = $this->defaultViewsPath;
172172
}
173173
$currentName = $foundBundle->getName();
174174
} catch (\InvalidArgumentException $e) {
175175
// such a bundle does not exist, so treat the argument as path
176176
$path = $input->getArgument('bundle');
177177

178178
$transPaths = [$path.'/translations'];
179-
$viewsPaths = [$path.'/templates'];
179+
$codePaths = [$path.'/templates'];
180180

181181
if (!is_dir($transPaths[0]) && !isset($transPaths[1])) {
182182
throw new InvalidArgumentException(sprintf('"%s" is neither an enabled bundle nor a directory.', $transPaths[0]));
@@ -191,7 +191,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
191191
$extractedCatalogue = new MessageCatalogue($input->getArgument('locale'));
192192
$io->comment('Parsing templates...');
193193
$this->extractor->setPrefix($input->getOption('prefix'));
194-
foreach ($viewsPaths as $path) {
194+
foreach ($codePaths as $path) {
195195
if (is_dir($path) || is_file($path)) {
196196
$this->extractor->extract($path, $extractedCatalogue);
197197
}

‎src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected function tearDown(): void
139139
$this->fs->remove($this->translationDir);
140140
}
141141

142-
private function createCommandTester($extractedMessages = [], $loadedMessages = [], $kernel = null, array $transPaths = [], array $viewsPaths = []): CommandTester
142+
private function createCommandTester($extractedMessages = [], $loadedMessages = [], $kernel = null, array $transPaths = [], array $codePaths = []): CommandTester
143143
{
144144
$translator = $this->createMock(Translator::class);
145145
$translator
@@ -190,7 +190,7 @@ function ($path, $catalogue) use ($loadedMessages) {
190190
->method('getContainer')
191191
->willReturn($container);
192192

193-
$command = new TranslationDebugCommand($translator, $loader, $extractor, $this->translationDir.'/translations', $this->translationDir.'/templates', $transPaths, $viewsPaths);
193+
$command = new TranslationDebugCommand($translator, $loader, $extractor, $this->translationDir.'/translations', $this->translationDir.'/templates', $transPaths, $codePaths);
194194

195195
$application = new Application($kernel);
196196
$application->add($command);

‎src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ protected function tearDown(): void
148148
/**
149149
* @return CommandTester
150150
*/
151-
private function createCommandTester($extractedMessages = [], $loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $viewsPaths = [])
151+
private function createCommandTester($extractedMessages = [], $loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $codePaths = [])
152152
{
153153
$translator = $this->createMock(Translator::class);
154154
$translator
@@ -209,7 +209,7 @@ function ($path, $catalogue) use ($loadedMessages) {
209209
->method('getContainer')
210210
->willReturn($container);
211211

212-
$command = new TranslationUpdateCommand($writer, $loader, $extractor, 'en', $this->translationDir.'/translations', $this->translationDir.'/templates', $transPaths, $viewsPaths);
212+
$command = new TranslationUpdateCommand($writer, $loader, $extractor, 'en', $this->translationDir.'/translations', $this->translationDir.'/templates', $transPaths, $codePaths);
213213

214214
$application = new Application($kernel);
215215
$application->add($command);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.