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

BeanstalkConnectionCacheProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 6
dl 0
loc 14
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 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
}