Passed
Push — develop ( 95acc4...822734 )
by Nikolay
04:43
created

BeanstalkConnectionCacheProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * Copyright (C) MIKO LLC - All Rights Reserved
6
 * Unauthorized copying of this file, via any medium is strictly prohibited
7
 * Proprietary and confidential
8
 * Written by Nikolay Beketov, 4 2020
9
 *
10
 */
11
12
namespace MikoPBX\Common\Providers;
13
14
15
use MikoPBX\AdminCabinet\Plugins\CacheCleanerPlugin;
16
use MikoPBX\Core\System\BeanstalkClient;
17
use Phalcon\Di\DiInterface;
18
use Phalcon\Di\ServiceProviderInterface;
19
20
/**
21
 *  We register the beansTalk connection for send cache clean events from backend to frontend
22
 */
23
class BeanstalkConnectionCacheProvider implements ServiceProviderInterface
24
{
25
    public const SERVICE_NAME = 'beanstalkConnectionCache';
26
    /**
27
     * Register beanstalkConnectionCache service provider
28
     *
29
     * @param \Phalcon\Di\DiInterface $di
30
     */
31
    public function register(DiInterface $di): void
32
    {
33
        $di->setShared(
34
            self::SERVICE_NAME,
35
            function () {
36
                return new BeanstalkClient(CacheCleanerPlugin::class);
37
            }
38
        );
39
    }
40
}