Passed
Push — 0.7.0 ( 2c5a8e...dc9ed8 )
by Alexander
10:13 queued 11s
created

CacheServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
dl 0
loc 31
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 1
A provides() 0 4 1
1
<?php
2
3
/**
4
 * Lenevor Framework
5
 *
6
 * LICENSE
7
 *
8
 * This source file is subject to the new BSD license that is bundled
9
 * with this package in the file license.md.
10
 * It is also available through the world-wide-web at this URL:
11
 * https://lenevor.com/license
12
 * If you did not receive a copy of the license and are unable to
13
 * obtain it through the world-wide-web, please send an email
14
 * to [email protected] so we can send you a copy immediately.
15
 *
16
 * @package     Lenevor
17
 * @subpackage  Base
18
 * @link        https://lenevor.com
19
 * @copyright   Copyright (c) 2019 - 2021 Alexander Campo <[email protected]>
20
 * @license     https://opensource.org/licenses/BSD-3-Clause New BSD license or see https://lenevor.com/license or see /license.md
21
 */
22
23
namespace Syscodes\Cache;
24
25
use Syscodes\Support\ServiceProvider;
26
use Syscodes\Contracts\Support\Deferrable;
27
use Syscodes\Cache\Store\MemcachedConnector;
28
29
/**
30
 * For loading the classes from the container of services.
31
 * 
32
 * @author Alexander Campo <[email protected]>
33
 */
34
class CacheServiceProvider extends ServiceProvider implements Deferrable
35
{
36
    /**
37
     * Register the service provider.
38
     * 
39
     * @return void
40
     */
41
    public function register()
42
    {
43
        $this->app->singleton('cache', function ($app) {
44
            return (new CacheManager($app));
45
        });
46
47
        $this->app->singleton('cache.store', function ($app) {
48
            return $app['cache']->driver();
49
        });
50
51
        $this->app->singleton('memcached.connector', function () {
52
            return new MemcachedConnector;
53
        });
54
    }
55
    
56
    /**
57
     * Get the services provided by the provider.
58
     * 
59
     * @return array
60
     */
61
    public function provides()
62
    {
63
        return [
64
            'cache', 'cache.store', 'memcached.connector',
65
        ];
66
    }
67
}