PublisherSingleton   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 2
c 1
b 0
f 0
dl 0
loc 8
ccs 2
cts 2
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
1
<?php
2
3
/**
4
 * @author Marwan Al-Soltany <[email protected]>
5
 * @copyright Marwan Al-Soltany 2020
6
 * For the full copyright and license information, please view
7
 * the LICENSE file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace MAKS\AmqpAgent\Worker;
13
14
use PhpAmqpLib\Connection\AMQPStreamConnection;
15
use PhpAmqpLib\Channel\AMQPChannel;
16
use PhpAmqpLib\Message\AMQPMessage;
17
use PhpAmqpLib\Wire\AMQPTable;
18
use MAKS\AmqpAgent\Worker\Publisher;
19
use MAKS\AmqpAgent\Worker\AbstractWorkerSingleton;
20
21
/**
22
 * A singleton version of the Publisher class.
23
 * Static and constant properties are accessed via object operator (`->` not `::`).
24
 *
25
 * Example:
26
 * ```
27
 * $publisher = PublisherSingleton::getInstance();
28
 * ```
29
 *
30
 * @since 1.0.0
31
 * @api
32
 * @see \MAKS\AmqpAgent\Worker\Publisher for the full API.
33
 * @method self connect()
34
 * @method self disconnect()
35
 * @method self reconnect()
36
 * @method self queue(?array $parameters = null, ?AMQPChannel $_channel = null)
37
 * @method ?AMQPStreamConnection getConnection()
38
 * @method self setConnection(AMQPStreamConnection $connection)
39
 * @method ?AMQPChannel getChannel()
40
 * @method self setChannel(AMQPChannel $channel)
41
 * @method ?AMQPChannel getNewChannel(array $parameters = null, ?AMQPStreamConnection $_connection = null)
42
 * @method ?AMQPChannel getChannelById(array $parameters = null)
43
 * @method self exchange(?array $parameters = null, ?AMQPChannel $_channel = null)
44
 * @method self bind(?array $parameters = null, ?AMQPChannel $_channel = null)
45
 * @method AMQPMessage message(string $body, ?array $properties = null)
46
 * @method self publish($payload, ?array $parameters = null, ?AMQPChannel $_channel = null)
47
 * @method self publishBatch(array $messages, int $batchSize = 2500, ?array $parameters = null, ?AMQPChannel $_channel = null)
48
 * @method self prepare()
49
 * @method void work($messages)
50
 * @method static AMQPTable arguments(array $array)
51
 * @method static bool shutdown(...$object)
52
 * @method static array makeCommand(string $name, string $value, $parameters = null, string $argument = 'params')
53
 * @method static bool isCommand($data)
54
 * @method static bool hasCommand(array $data, string $name = null, ?string $value = null)
55
 * @method static mixed getCommand(array $data, string $key = 'params', ?string $sub = null)
56
 */
57
final class PublisherSingleton extends AbstractWorkerSingleton
58
{
59
    /**
60
     * Use PublisherSingleton::getInstance() instead.
61
     */
62 1
    public function __construct()
63
    {
64 1
        $this->worker = new Publisher();
65 1
    }
66
}
67