forked from codeigniter4/CodeIgniter4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLanguageCommand.php
More file actions
40 lines (31 loc) · 1012 Bytes
/
Copy pathLanguageCommand.php
File metadata and controls
40 lines (31 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace Tests\Support\Commands;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\GeneratorTrait;
class LanguageCommand extends BaseCommand
{
use GeneratorTrait;
protected $group = 'Generators';
protected $name = 'publish:language';
protected $description = 'Publishes a language file.';
protected $usage = 'publish:language [options]';
protected $options = [
'--lang' => 'The language folder to save the file.',
'--sort' => 'Turn on/off the sortImports flag.',
];
public function run(array $params)
{
$this->setHasClassName(false);
$params[0] = 'Foobar';
$params['lang'] = $params['lang'] ?? 'en';
$this->component = 'Language';
$this->directory = 'Language\\' . $params['lang'];
$sort = (isset($params['sort']) && $params['sort'] === 'off') ? false : true;
$this->setSortImports($sort);
$this->execute($params);
}
protected function prepare(string $class): string
{
return file_get_contents(__DIR__ . '/Foobar.php') ?: '';
}
}