Test Failed
Push — master ( f5a4d5...ab7fb6 )
by Hirofumi
03:37
created

RequeueAbandonedJobMessageService::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 1
1
<?php
2
3
namespace Shippinno\Job\Application\Messaging;
4
5
use Interop\Queue\Exception as QueueException;
6
use Interop\Queue\PsrContext;
7
use Shippinno\Job\Domain\Model\AbandonedJobMessageStore;
8
9
class RequeueAbandonedJobMessageService
10
{
11
    /**
12
     * @var PsrContext
13
     */
14
    private $context;
15
16
    /**
17
     * @var AbandonedJobMessageStore
18
     */
19
    private $abandonedJobMessageStore;
20
21
    /**
22
     * @param PsrContext $context
23
     * @param AbandonedJobMessageStore $abandonedJobMessageStore
24
     */
25
    public function __construct(
26
        PsrContext $context,
27
        AbandonedJobMessageStore $abandonedJobMessageStore
28
    ) {
29
        $this->context = $context;
30
        $this->abandonedJobMessageStore = $abandonedJobMessageStore;
31
    }
32
33
    /**
34
     * @param int $abandonedJobMessageId
35
     * @throws \Shippinno\Job\Domain\Model\AbandonedJobMessageNotFoundException
36
     */
37
    public function execute(int $abandonedJobMessageId)
38
    {
39
        $abandonedJobMessage = $this->abandonedJobMessageStore->abandonedJobMessageOfId($abandonedJobMessageId);
40
        $queue = $this->context->createQueue($abandonedJobMessage->queue());
0 ignored issues
show
Bug introduced by
The method queue() does not seem to exist on object<Shippinno\Job\Dom...el\AbandonedJobMessage>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
41
        $message = $this->context->createMessage($$abandonedJobMessage->message());
42
        try {
43
            $this->context->createProducer()->send($queue, $message);
44
        } catch (QueueException $e) {
45
//            throw new FailedToEnqueueStoredJobException($e);
46
        }
47
    }
48
}
49