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

orchestral / workbench / 12552878300

30 Dec 2024 10:58PM UTC coverage: 94.318% (-0.03%) from 94.346%
12552878300

push

github

crynobone
wip

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

2 of 2 new or added lines in 1 file covered. (100.0%)

1 existing line in 1 file now uncovered.

581 of 616 relevant lines covered (94.32%)

16.88 hits per line

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

92.31
/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
     * @no-named-arguments
26
     *
27
     * @param  array<int, mixed>|string  ...$path
28
     */
29
    public static function applicationPath(array|string $path = ''): string
30
    {
31
        /** @var array<int, mixed> $path */
32
        $path = Arr::wrap(\func_num_args() > 1 ? \func_get_args() : $path);
1✔
33

34
        return base_path(join_paths(...$path));
1✔
35
    }
36

37
    /**
38
     * Get the path to the Laravel application skeleton.
39
     *
40
     * @no-named-arguments
41
     *
42
     * @param  array<int, mixed>|string  ...$path
43
     *
44
     * @see \Orchestra\Workbench\Workbench::applicationPath()
45
     */
46
    public static function laravelPath(array|string $path = ''): string
47
    {
48
        return static::applicationPath($path);
1✔
49
    }
50

51
    /**
52
     * Get the path to the package folder.
53
     *
54
     * @no-named-arguments
55
     *
56
     * @param  array<int, mixed>|string  ...$path
57
     */
58
    public static function packagePath(array|string $path = ''): string
59
    {
60
        /** @var array<int, mixed> $path */
61
        $path = Arr::wrap(\func_num_args() > 1 ? \func_get_args() : $path);
19✔
62

63
        return package_path(...$path);
19✔
64
    }
65

66
    /**
67
     * Get the path to the workbench folder.
68
     *
69
     * @no-named-arguments
70
     */
71
    public static function path(array|string $path = ''): string
72
    {
73
        /** @var array<int, mixed> $path */
74
        $path = Arr::wrap(\func_num_args() > 1 ? \func_get_args() : $path);
20✔
75

76
        return workbench_path(...$path);
20✔
77
    }
78

79
    /**
80
     * Get the availale configuration.
81
     *
82
     * @return array<string, mixed>|mixed
83
     *
84
     * @phpstan-return ($key is null ? TWorkbenchConfig : mixed)
85
     */
86
    public static function config(?string $key = null): mixed
87
    {
88
        return ! \is_null($key)
41✔
89
            ? Arr::get(workbench(), $key)
11✔
90
            : workbench();
41✔
91
    }
92

93
    /**
94
     * Retrieve Stub Registrar instance.
95
     */
96
    public static function stub(): StubRegistrar
97
    {
98
        return static::$stubRegistrar ??= new StubRegistrar;
29✔
99
    }
100

101
    /**
102
     * Swap stub file by name.
103
     */
104
    public static function swapFile(string $name, ?string $file): void
105
    {
UNCOV
106
        static::stub()->swap($name, $file);
×
107
    }
108

109
    /**
110
     * Retrieve the stub file from name.
111
     */
112
    public static function stubFile(string $name): ?string
113
    {
114
        return static::stub()->file($name);
29✔
115
    }
116
}
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