Issues (2)

src/Providers/OpenViduServiceProvider.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace SquareetLabs\LaravelOpenVidu\Providers;
4
5
use Illuminate\Support\Facades\Cache;
6
use Illuminate\Support\Facades\DB;
7
use Illuminate\Support\Facades\Route;
8
use Illuminate\Support\ServiceProvider;
9
use SquareetLabs\LaravelOpenVidu\Cache\SessionStore;
10
use SquareetLabs\LaravelOpenVidu\OpenVidu;
11
12
/**
13
 * Class OpenViduServiceProvider
14
 * @package SquareetLabs\LaravelOpenVidu\Providers
15
 */
16
class OpenViduServiceProvider extends ServiceProvider
17
{
18
    /**
19
     * Register.
20
     */
21
    public function register()
22
    {
23
        $this->app->singleton(OpenVidu::class, function () {
24
            return new OpenVidu(/** @scrutinizer ignore-call */ config('services.openvidu'));
25
        });
26
27
        $this->app->alias(OpenVidu::class, 'openVidu');
28
        //Default parameter added true due to the compatibility
29
        if (config('services.openvidu.use_routes', true)) {
0 ignored issues
show
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

29
        if (/** @scrutinizer ignore-call */ config('services.openvidu.use_routes', true)) {
Loading history...
30
            $this->registerRoutes();
31
        }
32
    }
33
34
    /**
35
     * Register the package routes.
36
     *
37
     * @return void
38
     */
39
    private function registerRoutes()
40
    {
41
        Route::group($this->routeConfiguration(), function () {
42
            $this->loadRoutesFrom(__DIR__.'/../Http/routes.php');
43
        });
44
    }
45
46
    /**
47
     * Get the SmsUp route group configuration array.
48
     *
49
     * @return array
50
     */
51
    private function routeConfiguration()
52
    {
53
        return [
54
            'domain' => null,
55
            'namespace' => 'SquareetLabs\LaravelOpenVidu\Http\Controllers',
56
            'prefix' => 'openvidu'
57
        ];
58
    }
59
60
    /**
61
     * Bootstrap the application services.
62
     *
63
     * @return void
64
     */
65
    public function boot()
66
    {
67
        if ($this->app->runningInConsole()) {
68
            $this->loadMigrationsFrom(__DIR__.'/../../database/migrations');
69
70
            $this->publishes([
71
                __DIR__.'/../../database/migrations' => /** @scrutinizer ignore-call */ database_path('migrations'),
72
            ], 'openvidu-migrations');
73
74
        }
75
        Cache::extend('openvidu', function () {
76
            return Cache::repository(new SessionStore(DB::connection(), /** @scrutinizer ignore-call */ config('cache.stores.openvidu.table')));
77
        });
78
    }
79
}
80