Code Duplication    Length = 14-14 lines in 2 locations

src/Client/ZeroMqClient.php 1 location

@@ 61-74 (lines=14) @@
58
    /**
59
     * @return ZMQSocket
60
     */
61
    private function getSocket()
62
    {
63
        if ($this->socket === null) {
64
            $context = new ZMQContext();
65
66
            $host = $this->location->getHost();
67
            $port = $this->location->getPort();
68
69
            $this->socket = new ZMQSocket($context, ZMQ::SOCKET_PUSH, spl_object_hash($this));
70
            $this->socket->connect("tcp://{$host}:$port");
71
        }
72
73
        return $this->socket;
74
    }
75
76
    /**
77
     * @inheritdoc

src/Server/ZeroMqServer.php 1 location

@@ 97-110 (lines=14) @@
94
    /**
95
     * @return ZMQSocket
96
     */
97
    private function getSocket()
98
    {
99
        if ($this->socket === null) {
100
            $context = new ZMQContext();
101
102
            $host = $this->location->getHost();
103
            $port = $this->location->getPort();
104
105
            $this->socket = new ZMQSocket($context, ZMQ::SOCKET_PULL, spl_object_hash($this));
106
            $this->socket->bind("tcp://{$host}:$port");
107
        }
108
109
        return $this->socket;
110
    }
111
112
    /**
113
     * @param Event $event