Code Duplication    Length = 22-22 lines in 2 locations

src/Entity/ExchangeEntity.php 1 location

@@ 114-135 (lines=22) @@
111
    /**
112
     * Create the Queue
113
     */
114
    public function create()
115
    {
116
        try {
117
            $this->getChannel()
118
                ->exchange_declare(
119
                    $this->attributes['name'],
120
                    $this->attributes['exchange_type'],
121
                    $this->attributes['passive'],
122
                    $this->attributes['durable'],
123
                    $this->attributes['auto_delete'],
124
                    $this->attributes['internal'],
125
                    $this->attributes['nowait']
126
                );
127
        } catch (AMQPProtocolChannelException $e) {
128
            // 406 is a soft error triggered for precondition failure (when redeclaring with different parameters)
129
            if (true === $this->attributes['throw_exception_on_redeclare'] || $e->amqp_reply_code !== 406) {
130
                throw $e;
131
            }
132
            // a failure trigger channels closing process
133
            $this->getConnection()->reconnect();
134
        }
135
    }
136
137
    /**
138
     * @throws AMQPProtocolChannelException

src/Entity/QueueEntity.php 1 location

@@ 173-194 (lines=22) @@
170
    /**
171
     * Create the Queue
172
     */
173
    public function create()
174
    {
175
        try {
176
            $this->getChannel()
177
                ->queue_declare(
178
                    $this->attributes['name'],
179
                    $this->attributes['passive'],
180
                    $this->attributes['durable'],
181
                    $this->attributes['exclusive'],
182
                    $this->attributes['auto_delete'],
183
                    $this->attributes['internal'],
184
                    $this->attributes['nowait']
185
                );
186
        } catch (AMQPProtocolChannelException $e) {
187
            // 406 is a soft error triggered for precondition failure (when redeclaring with different parameters)
188
            if (true === $this->attributes['throw_exception_on_redeclare'] || $e->amqp_reply_code !== 406) {
189
                throw $e;
190
            }
191
            // a failure trigger channels closing process
192
            $this->reconnect();
193
        }
194
    }
195
196
    public function bind()
197
    {