Issues (197)

src/LumenDomainsServiceProvider.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Salah3id\Domains;
4
5
use Salah3id\Domains\Support\Stub;
6
7
class LumenDomainsServiceProvider extends DomainsServiceProvider
8
{
9
    /**
10
     * Booting the package.
11
     */
12
    public function boot()
13
    {
14
        $this->setupStubPath();
15
    }
16
17
    /**
18
     * Register all domains.
19
     */
20
    public function register()
21
    {
22
        $this->registerNamespaces();
23
        $this->registerServices();
24
        $this->registerDomains();
25
        $this->registerProviders();
26
    }
27
28
    /**
29
     * Setup stub path.
30
     */
31
    public function setupStubPath()
32
    {
33
        Stub::setBasePath(__DIR__ . '/Commands/stubs');
34
35
        if (app('domains')->config('stubs.enabled') === true) {
0 ignored issues
show
The method config() does not exist on Illuminate\Contracts\Foundation\Application. Did you maybe mean configPath()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
        if (app('domains')->/** @scrutinizer ignore-call */ config('stubs.enabled') === true) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
36
            Stub::setBasePath(app('domains')->config('stubs.path'));
37
        }
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    protected function registerServices()
44
    {
45
        $this->app->singleton(Contracts\RepositoryInterface::class, function ($app) {
46
            $path = $app['config']->get('domains.paths.domains');
47
48
            return new Lumen\LumenFileRepository($app, $path);
49
        });
50
        $this->app->singleton(Contracts\ActivatorInterface::class, function ($app) {
51
            $activator = $app['config']->get('domains.activator');
52
            $class = $app['config']->get('domains.activators.' . $activator)['class'];
53
54
            return new $class($app);
55
        });
56
        $this->app->alias(Contracts\RepositoryInterface::class, 'domains');
57
    }
58
}
59