-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathGenerateProducerCommand.php
More file actions
38 lines (31 loc) · 843 Bytes
/
GenerateProducerCommand.php
File metadata and controls
38 lines (31 loc) · 843 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
<?php
declare(strict_types=1);
namespace Bow\Console\Command\Generator;
use Bow\Console\AbstractCommand;
use Bow\Console\Color;
use Bow\Console\Generator;
class GenerateProducerCommand extends AbstractCommand
{
/**
* Add producer
*
* @param string $producer
* @return void
*/
public function run(string $producer): void
{
$generator = new Generator(
$this->setting->getProducerDirectory(),
$producer
);
if ($generator->fileExists()) {
echo Color::red("The producer already exists");
exit(1);
}
$generator->write('producer', [
'baseNamespace' => $this->namespaces['producer'] ?? 'App\\Producers'
]);
echo Color::green("The producer has been well created.");
exit(0);
}
}