• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Jagepard / Rudra-Cli / 15920986328

27 Jun 2025 07:42AM UTC coverage: 4.771% (-95.2%) from 100.0%
15920986328

push

github

web-flow
Merge pull request #29 from Jagepard/wip

adds commands

0 of 479 new or added lines in 20 files covered. (0.0%)

24 of 503 relevant lines covered (4.77%)

0.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Command/CreateFactoryCommand.php
1
<?php
2

3
namespace Rudra\Cli\Command;
4

5
use App\Ship\Utils\FileCreator;
6
use Rudra\Container\Facades\Rudra;
7
use Rudra\Cli\Command\ConsoleFacade as Cli;
8

9
class CreateFactoryCommand extends FileCreator
10
{
11
    /**
12
     * Creates a file with Seed data
13
     * -----------------------------
14
     * Создает файл с данными Seed
15
     */
NEW
16
    public function actionIndex(): void
×
17
    {
NEW
18
        Cli::printer("Enter factory name: ", "magneta");
×
NEW
19
        $prefix    = str_replace(PHP_EOL, "", Cli::reader());
×
NEW
20
        $className = ucfirst($prefix) . 'Factory';
×
21

NEW
22
        Cli::printer("Enter container: ", "magneta");
×
NEW
23
        $container = ucfirst(str_replace(PHP_EOL, "", Cli::reader()));
×
24

NEW
25
        if (!empty($container)) {
×
NEW
26
            if (!is_dir(Rudra::config()->get('app.path') . "/app/Containers/$container/")) {
×
NEW
27
                Cli::printer("⚠️  Container '$container' does not exist" . PHP_EOL, "light_yellow");
×
NEW
28
                return;
×
29
            }
30
            
NEW
31
            $this->writeFile(
×
NEW
32
                [Rudra::config()->get('app.path') . "/app/Containers/$container/Factory/", "{$className}.php"],
×
NEW
33
                $this->createClass($className, $container)
×
NEW
34
            );
×
35

36
        } else {
NEW
37
            $this->actionIndex();
×
38
        }
39
    }
40

41
    /**
42
     * Creates class data
43
     * ------------------
44
     * Создает данные класса
45
     *
46
     * @param string $className
47
     * @param string $container
48
     * @return string
49
     */
NEW
50
    private function createClass(string $className, string $container): string
×
51
    {
NEW
52
        return <<<EOT
×
NEW
53
<?php
×
54

NEW
55
namespace App\Containers\\{$container}\Factory;
×
56

57
use Rudra\Container\Interfaces\FactoryInterface;
58

NEW
59
class {$className} implements FactoryInterface
×
60
{
61
    public function create()
62
    {
63

64
    }
65
}\r\n
NEW
66
EOT;
×
67
    }
68
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc