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

BeanstalkConnectionModelsProvider   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
c 1
b 0
f 0
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 1
1
<?php
2
/*
3
 * Copyright (C) MIKO LLC - All Rights Reserved
4
 * Unauthorized copying of this file, via any medium is strictly prohibited
5
 * Proprietary and confidential
6
 * Written by Nikolay Beketov, 11 2020
7
 *
8
 */
9
10
declare(strict_types=1);
11
/**
12
 * Copyright (C) MIKO LLC - All Rights Reserved
13
 * Unauthorized copying of this file, via any medium is strictly prohibited
14
 * Proprietary and confidential
15
 * Written by Nikolay Beketov, 4 2020
16
 *
17
 */
18
19
namespace MikoPBX\Common\Providers;
20
21
22
use MikoPBX\Core\System\BeanstalkClient;
23
use MikoPBX\Core\Workers\WorkerModelsEvents;
24
use Phalcon\Di\DiInterface;
25
use Phalcon\Di\ServiceProviderInterface;
26
27
/**
28
 *  We register the beansTalk connection for send models changes to backend application
29
 */
30
class BeanstalkConnectionModelsProvider implements ServiceProviderInterface
31
{
32
    public const SERVICE_NAME = 'beanstalkConnectionModels';
33
    /**
34
     * Register beanstalkConnectionModels service provider
35
     *
36
     * @param \Phalcon\Di\DiInterface $di
37
     */
38
    public function register(DiInterface $di): void
39
    {
40
        $di->setShared(
41
            self::SERVICE_NAME,
42
            function () {
43
                return new BeanstalkClient(WorkerModelsEvents::class);
44
            }
45
        );
46
    }
47
}