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

orchestral / workbench / 11902989910

18 Nov 2024 11:24PM UTC coverage: 96.629% (-2.6%) from 99.248%
11902989910

push

github

crynobone
Merge branch '9.x' into 10.x

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

37 of 38 new or added lines in 7 files covered. (97.37%)

172 of 178 relevant lines covered (96.63%)

8.98 hits per line

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

93.33
/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
16
{
17
    /**
18
     * The Stub Registrar instance.
19
     *
20
     * @var \Orchestra\Workbench\StubRegistrar|null
21
     */
22
    protected static $stubRegistrar = null;
23

24
    /**
25
     * Get the path to the laravel folder.
26
     */
27
    public static function laravelPath(array|string $path = ''): string
28
    {
29
        return app()->basePath(
1✔
30
            join_paths(...Arr::wrap(\func_num_args() > 1 ? \func_get_args() : $path))
1✔
31
        );
1✔
32
    }
33

34
    /**
35
     * Get the path to the package folder.
36
     */
37
    public static function packagePath(array|string $path = ''): string
38
    {
39
        return package_path(
1✔
40
            ...Arr::wrap(\func_num_args() > 1 ? \func_get_args() : $path)
1✔
41
        );
1✔
42
    }
43

44
    /**
45
     * Get the path to the workbench folder.
46
     */
47
    public static function path(array|string $path = ''): string
48
    {
49
        return workbench_path(
2✔
50
            ...Arr::wrap(\func_num_args() > 1 ? \func_get_args() : $path)
2✔
51
        );
2✔
52
    }
53

54
    /**
55
     * Get the availale configuration.
56
     *
57
     * @return array<string, mixed>|mixed
58
     *
59
     * @phpstan-return ($key is null ? TWorkbenchConfig : mixed)
60
     */
61
    public static function config(?string $key = null): mixed
62
    {
63
        return ! \is_null($key)
17✔
64
            ? Arr::get(workbench(), $key)
9✔
65
            : workbench();
17✔
66
    }
67

68
    /**
69
     * Retrieve Stub Registrar instance.
70
     */
71
    public static function stub(): StubRegistrar
72
    {
73
        return static::$stubRegistrar ??= new StubRegistrar;
1✔
74
    }
75

76
    /**
77
     * Swap stub file by name.
78
     */
79
    public static function swapFile(string $name, ?string $file): void
80
    {
NEW
81
        static::stub()->swap($name, $file);
×
82
    }
83

84
    /**
85
     * Retrieve the stub file from name.
86
     */
87
    public static function stubFile(string $name): ?string
88
    {
89
        return static::stub()->file($name);
1✔
90
    }
91
}
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