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

BeanstalkConnectionWorkerApiProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 6
c 0
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
 * 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
}