Code Duplication    Length = 22-22 lines in 2 locations

src/Requests/Decision.php 1 location

@@ 16-37 (lines=22) @@
13
 *
14
 * @package Covery\Client\Requests
15
 */
16
class Decision extends Request
17
{
18
    public function __construct(EnvelopeInterface $envelope)
19
    {
20
        // Building request
21
        $ids = array();
22
        foreach ($envelope->getIdentities() as $id) {
23
            $ids[] = $id->getType() . '=' . $id->getId();
24
        }
25
26
        $packet = array('type' => $envelope->getType(), 'sequence_id' => $envelope->getSequenceId());
27
28
        parent::__construct(
29
            'POST',
30
            TransportInterface::DEFAULT_URL . 'api/makeDecision',
31
            array(
32
                'X-Identities' => implode('&', $ids)
33
            ),
34
            json_encode(array_merge($packet, $envelope->toArray()))
35
        );
36
    }
37
}

src/Requests/Event.php 1 location

@@ 17-38 (lines=22) @@
14
 *
15
 * @package Covery\Client\Requests
16
 */
17
class Event extends Request
18
{
19
    public function __construct(EnvelopeInterface $envelope)
20
    {
21
        // Building request
22
        $ids = array();
23
        foreach ($envelope->getIdentities() as $id) {
24
            $ids[] = $id->getType() . '=' . $id->getId();
25
        }
26
27
        $packet = array('type' => $envelope->getType(), 'sequence_id' => $envelope->getSequenceId());
28
29
        parent::__construct(
30
            'POST',
31
            TransportInterface::DEFAULT_URL . 'api/sendEvent',
32
            array(
33
                'X-Identities' => implode('&', $ids)
34
            ),
35
            json_encode(array_merge($packet, $envelope->toArray()))
36
        );
37
    }
38
}
39