Completed
Push — develop ( 10e106...3e91b1 )
by Abdelrahman
01:11
created

SubscriptionsServiceProvider::publishResources()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Subscriptions\Providers;
6
7
use Rinvex\Subscriptions\Models\Plan;
8
use Illuminate\Support\ServiceProvider;
9
use Rinvex\Support\Traits\ConsoleTools;
10
use Rinvex\Subscriptions\Models\PlanFeature;
11
use Rinvex\Subscriptions\Models\PlanSubscription;
12
use Rinvex\Subscriptions\Models\PlanSubscriptionUsage;
13
use Rinvex\Subscriptions\Console\Commands\MigrateCommand;
14
use Rinvex\Subscriptions\Console\Commands\PublishCommand;
15
use Rinvex\Subscriptions\Console\Commands\RollbackCommand;
16
17
class SubscriptionsServiceProvider extends ServiceProvider
18
{
19
    use ConsoleTools;
20
21
    /**
22
     * The commands to be registered.
23
     *
24
     * @var array
25
     */
26
    protected $commands = [
27
        MigrateCommand::class => 'command.rinvex.subscriptions.migrate',
28
        PublishCommand::class => 'command.rinvex.subscriptions.publish',
29
        RollbackCommand::class => 'command.rinvex.subscriptions.rollback',
30
    ];
31
32
    /**
33
     * Register the application services.
34
     *
35
     * @return void
36
     */
37
    public function register(): void
38
    {
39
        $this->mergeConfigFrom(realpath(__DIR__.'/../../config/config.php'), 'rinvex.subscriptions');
40
41
        // Bind eloquent models to IoC container
42
        $this->app->singleton('rinvex.subscriptions.plan', $planModel = $this->app['config']['rinvex.subscriptions.models.plan']);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 130 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
43
        $planModel === Plan::class || $this->app->alias('rinvex.subscriptions.plan', Plan::class);
44
45
        $this->app->singleton('rinvex.subscriptions.plan_feature', $planFeatureModel = $this->app['config']['rinvex.subscriptions.models.plan_feature']);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 153 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
46
        $planFeatureModel === PlanFeature::class || $this->app->alias('rinvex.subscriptions.plan_feature', PlanFeature::class);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 127 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
47
48
        $this->app->singleton('rinvex.subscriptions.plan_subscription', $planSubscriptionModel = $this->app['config']['rinvex.subscriptions.models.plan_subscription']);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 168 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
49
        $planSubscriptionModel === PlanSubscription::class || $this->app->alias('rinvex.subscriptions.plan_subscription', PlanSubscription::class);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 147 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
50
51
        $this->app->singleton('rinvex.subscriptions.plan_subscription_usage', $planSubscriptionUsageModel = $this->app['config']['rinvex.subscriptions.models.plan_subscription_usage']);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 185 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
52
        $planSubscriptionUsageModel === PlanSubscriptionUsage::class || $this->app->alias('rinvex.subscriptions.plan_subscription_usage', PlanSubscriptionUsage::class);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 168 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
53
54
        // Register console commands
55
        ! $this->app->runningInConsole() || $this->registersCommands();
56
    }
57
58
    /**
59
     * Bootstrap the application services.
60
     *
61
     * @return void
62
     */
63
    public function boot(): void
64
    {
65
        // Publish Resources
66
        ! $this->app->runningInConsole() || $this->publishesConfig('rinvex/laravel-subscriptions');
67
        ! $this->app->runningInConsole() || $this->publishesMigrations('rinvex/laravel-subscriptions');
68
    }
69
}
70