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

orchestral / canvas-core / 6217080730

18 Sep 2023 01:19AM UTC coverage: 90.909% (+4.8%) from 86.066%
6217080730

Pull #7

github

crynobone
wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Pull Request #7: Use `Illuminate\Console\GeneratorCommand`

30 of 30 new or added lines in 4 files covered. (100.0%)

30 of 33 relevant lines covered (90.91%)

1.06 hits per line

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

85.71
/src/Presets/Preset.php
1
<?php
2

3
namespace Orchestra\Canvas\Core\Presets;
4

5
use Illuminate\Contracts\Foundation\Application;
6
use LogicException;
7

8
abstract class Preset
9
{
10
    /**
11
     * The application instance.
12
     *
13
     * @var \Illuminate\Contracts\Foundation\Application
14
     */
15
    protected $app;
16

17
    /**
18
     * Construct a new preset.
19
     *
20
     * @return void
21
     */
22
    public function __construct(Application $app)
23
    {
24
        $this->app = $app;
2✔
25
    }
26

27
    /**
28
     * Check if preset name equal to $name.
29
     *
30
     * @param  string  $name
31
     * @return bool
32
     */
33
    public function is($name)
34
    {
35
        return $this->name() === $name;
2✔
36
    }
37

38
    /**
39
     * Get the model for the default guard's user provider.
40
     *
41
     * @param  string|null  $guard
42
     * @return string|null
43
     */
44
    public function userProviderModel($guard = null)
45
    {
46
        /** @var \Illuminate\Contracts\Config\Repository $config */
47
        $config = $this->app->make('config');
1✔
48

49
        $guard = $guard ?: $config->get('auth.defaults.guard');
1✔
50

51
        if (\is_null($provider = $config->get('auth.guards.'.$guard.'.provider'))) {
1✔
52
            throw new LogicException('The ['.$guard.'] guard is not defined in your "auth" configuration file.');
×
53
        }
54

55
        return $config->get("auth.providers.{$provider}.model");
1✔
56
    }
57

58
    /**
59
     * Preset name.
60
     *
61
     * @return string
62
     */
63
    abstract public function name();
64

65
    /**
66
     * Get the path to the base working directory.
67
     *
68
     * @return string
69
     */
70
    abstract public function basePath();
71

72
    /**
73
     * Get the path to the source directory.
74
     *
75
     * @return string
76
     */
77
    abstract public function sourcePath();
78

79
    /**
80
     * Get the path to the testing directory.
81
     *
82
     * @return string
83
     */
84
    abstract public function testingPath();
85

86
    /**
87
     * Get the path to the resource directory.
88
     *
89
     * @return string
90
     */
91
    abstract public function resourcePath();
92

93
    /**
94
     * Get the path to the view directory.
95
     *
96
     * @return string
97
     */
98
    abstract public function viewPath();
99

100
    /**
101
     * Get the path to the factory directory.
102
     *
103
     * @return string
104
     */
105
    abstract public function factoryPath();
106

107
    /**
108
     * Get the path to the migration directory.
109
     *
110
     * @return string
111
     */
112
    abstract public function migrationPath();
113

114
    /**
115
     * Get the path to the seeder directory.
116
     *
117
     * @return string
118
     */
119
    abstract public function seederPath();
120

121
    /**
122
     * Preset namespace.
123
     *
124
     * @return string
125
     */
126
    abstract public function rootNamespace();
127

128
    /**
129
     * Command namespace.
130
     *
131
     * @return string
132
     */
133
    abstract public function commandNamespace();
134

135
    /**
136
     * Model namespace.
137
     *
138
     * @return string
139
     */
140
    abstract public function modelNamespace();
141

142
    /**
143
     * Provider namespace.
144
     *
145
     * @return string
146
     */
147
    abstract public function providerNamespace();
148

149
    /**
150
     * Testing namespace.
151
     *
152
     * @return string
153
     */
154
    abstract public function testingNamespace();
155

156
    /**
157
     * Database factory namespace.
158
     *
159
     * @return string
160
     */
161
    abstract public function factoryNamespace();
162

163
    /**
164
     * Database seeder namespace.
165
     *
166
     * @return string
167
     */
168
    abstract public function seederNamespace();
169

170
    /**
171
     * Preset has custom stub path.
172
     *
173
     * @return bool
174
     */
175
    abstract public function hasCustomStubPath();
176
}
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