ZmqDealer::prepareBinderMessage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 0
cts 4
cp 0
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php
2
3
namespace Dazzle\ChannelZmq;
4
5
use Dazzle\Channel\Model\ModelInterface;
6
7
class ZmqDealer extends ZmqModel implements ModelInterface
8
{
9
    /**
10
     * @return int
11
     */
12
    protected function getSocketType()
13
    {
14
        return \ZMQ::SOCKET_DEALER;
15
    }
16
17
    /**
18
     * @param string[] $multipartMessage
19
     * @return string[]
0 ignored issues
show
Documentation introduced by
Should the return type not be array<string|string[]>?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
20
     */
21 View Code Duplication
    protected function parseBinderMessage($multipartMessage)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
    {
23
        $id = $multipartMessage[1];
24
        $type = $multipartMessage[2];
25
        $message = array_slice($multipartMessage, 3);
26
27
        return [ $id, $type, $message ];
28
    }
29
30
    /**
31
     * @param string[] $multipartMessage
32
     * @return string[]
0 ignored issues
show
Documentation introduced by
Should the return type not be array<string|string[]>?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
33
     */
34 View Code Duplication
    protected function parseConnectorMessage($multipartMessage)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
35
    {
36
        $id = $multipartMessage[1];
37
        $type = $multipartMessage[2];
38
        $message = array_slice($multipartMessage, 3);
39
40
        return [ $id, $type, $message ];
41
    }
42
43
    /**
44
     * @param string $id
45
     * @param string $type
46
     * @return string[]
47
     */
48
    protected function prepareBinderMessage($id, $type)
49
    {
50
        return [ $id, $this->id, $type ];
51
    }
52
53
    /**
54
     * @param string $id
55
     * @param string $type
56
     * @return string[]
57
     */
58
    protected function prepareConnectorMessage($id, $type)
59
    {
60
        return [ $id, $this->id, $type ];
61
    }
62
}
63