Passed
Pull Request — master (#23)
by Nikolay
09:42 queued 03:08
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
    /**
28
     * Register beanstalkConnectionCache service provider
29
     *
30
     * @param \Phalcon\Di\DiInterface $di
31
     */
32
    public function register(DiInterface $di): void
33
    {
34
        $di->setShared(
35
            self::SERVICE_NAME,
36
            function () {
37
                return new BeanstalkClient(CacheCleanerPlugin::class);
38
            }
39
        );
40
    }
41
}