Passed
Push — develop ( b7c00c...da1f69 )
by Nikolay
08:07 queued 01:43
created

BeanstalkConnectionWorkerApiProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 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\PBXCoreREST\Workers\WorkerApiCommands;
24
use Phalcon\Di\DiInterface;
25
use Phalcon\Di\ServiceProviderInterface;
26
27
/**
28
 *  We register the beansTalk connection to process the REST API commands
29
 */
30
class BeanstalkConnectionWorkerApiProvider implements ServiceProviderInterface
31
{
32
    public const SERVICE_NAME = 'beanstalkConnectionWorkerAPI';
33
34
    /**
35
     * Register beanstalkConnectionWorkerAPI service provider
36
     *
37
     * @param \Phalcon\Di\DiInterface $di
38
     */
39
    public function register(DiInterface $di): void
40
    {
41
        $di->setShared(
42
            self::SERVICE_NAME,
43
            function () {
44
                return new BeanstalkClient(WorkerApiCommands::class);
45
            }
46
        );
47
    }
48
}