Completed
Push — master ( 1635a7...6ef687 )
by Abdelrahman
02:47 queued 01:24
created

BaseServiceProvider::bindIfNotBound()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 4
c 1
b 0
f 0
nc 3
nop 4
dl 0
loc 7
rs 9.2
1
<?php
2
3
/*
4
 * NOTICE OF LICENSE
5
 *
6
 * Part of the Rinvex Support Package.
7
 *
8
 * This source file is subject to The MIT License (MIT)
9
 * that is bundled with this package in the LICENSE file.
10
 *
11
 * Package: Rinvex Support Package
12
 * License: The MIT License (MIT)
13
 * Link:    https://rinvex.com
14
 */
15
16
namespace Rinvex\Support\Providers;
17
18
use Illuminate\Support\ServiceProvider;
19
20
abstract class BaseServiceProvider extends ServiceProvider
21
{
22
    /**
23
     * Register an IoC binding if it's not already been registered.
24
     *
25
     * @param string               $abstract
26
     * @param \Closure|string|null $concrete
27
     * @param bool                 $shared
28
     * @param bool                 $force
29
     *
30
     * @return void
31
     */
32
    protected function bindIfNotBound($abstract, $concrete = null, $shared = true, $force = false)
33
    {
34
        if (! $this->app->bound($abstract) || $force) {
35
            $concrete = $concrete ?: $abstract;
36
            $this->app->bind($abstract, $concrete, $shared);
37
        }
38
    }
39
}
40