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

orchestral / workbench / 12343244526

15 Dec 2024 11:36PM UTC coverage: 92.611%. Remained the same
12343244526

push

github

crynobone
Release 8.15.0

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

564 of 609 relevant lines covered (92.61%)

14.81 hits per line

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

93.75
/src/Workbench.php
1
<?php
2

3
namespace Orchestra\Workbench;
4

5
use Illuminate\Support\Arr;
6

7
use function Orchestra\Testbench\join_paths;
8
use function Orchestra\Testbench\package_path;
9
use function Orchestra\Testbench\workbench;
10
use function Orchestra\Testbench\workbench_path;
11

12
/**
13
 * @phpstan-import-type TWorkbenchConfig from \Orchestra\Testbench\Foundation\Config
14
 */
15
class Workbench extends \Orchestra\Testbench\Workbench\Workbench
16
{
17
    /**
18
     * The Stub Registrar instance.
19
     */
20
    protected static ?StubRegistrar $stubRegistrar = null;
21

22
    /**
23
     * Get the path to the application (Laravel) folder.
24
     */
25
    public static function applicationPath(array|string $path = ''): string
26
    {
27
        return base_path(
1✔
28
            join_paths(...Arr::wrap(\func_num_args() > 1 ? \func_get_args() : $path))
1✔
29
        );
1✔
30
    }
31

32
    /**
33
     * Get the path to the Laravel application skeleton.
34
     *
35
     * @see \Orchestra\Workbench\Workbench::applicationPath()
36
     */
37
    public static function laravelPath(array|string $path = ''): string
38
    {
39
        return static::applicationPath($path);
1✔
40
    }
41

42
    /**
43
     * Get the path to the package folder.
44
     */
45
    public static function packagePath(array|string $path = ''): string
46
    {
47
        return package_path(
16✔
48
            ...Arr::wrap(\func_num_args() > 1 ? \func_get_args() : $path)
16✔
49
        );
16✔
50
    }
51

52
    /**
53
     * Get the path to the workbench folder.
54
     */
55
    public static function path(array|string $path = ''): string
56
    {
57
        return workbench_path(
17✔
58
            ...Arr::wrap(\func_num_args() > 1 ? \func_get_args() : $path)
17✔
59
        );
17✔
60
    }
61

62
    /**
63
     * Get the availale configuration.
64
     *
65
     * @return array<string, mixed>|mixed
66
     *
67
     * @phpstan-return ($key is null ? TWorkbenchConfig : mixed)
68
     */
69
    public static function config(?string $key = null): mixed
70
    {
71
        return ! \is_null($key)
41✔
72
            ? Arr::get(workbench(), $key)
11✔
73
            : workbench();
41✔
74
    }
75

76
    /**
77
     * Retrieve Stub Registrar instance.
78
     */
79
    public static function stub(): StubRegistrar
80
    {
81
        return static::$stubRegistrar ??= new StubRegistrar;
27✔
82
    }
83

84
    /**
85
     * Swap stub file by name.
86
     */
87
    public static function swapFile(string $name, ?string $file): void
88
    {
89
        static::stub()->swap($name, $file);
×
90
    }
91

92
    /**
93
     * Retrieve the stub file from name.
94
     */
95
    public static function stubFile(string $name): ?string
96
    {
97
        return static::stub()->file($name);
27✔
98
    }
99
}
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

© 2025 Coveralls, Inc