Passed
Pull Request — master (#23)
by Nikolay
09:42 queued 03:08
created

BeanstalkConnectionCacheProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

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
    /**
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
}