1 | <?php |
||
11 | class AmazonSqsDriver implements DriverInterface |
||
12 | { |
||
13 | use SerializerAwareTrait; |
||
14 | |||
15 | /** |
||
16 | * @var SqsClient |
||
17 | */ |
||
18 | private $client; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | private $queueName; |
||
24 | |||
25 | /** |
||
26 | * string |
||
27 | */ |
||
28 | private $queueUrl; |
||
29 | |||
30 | /** |
||
31 | * integer |
||
32 | */ |
||
33 | private $sleepInterval = 0; |
||
34 | |||
35 | /** |
||
36 | * Create new Amazon SQS driver. |
||
37 | * |
||
38 | * You have to create aws client instnace and provide it to this driver. |
||
39 | * You can use service builder or factory method. |
||
40 | * |
||
41 | * <code> |
||
42 | * use Aws\Sqs\SqsClient; |
||
43 | * |
||
44 | * $client = SqsClient::factory(array( |
||
45 | * 'profile' => '<profile in your aws credentials file>', |
||
46 | * 'region' => '<region name>' |
||
47 | * )); |
||
48 | * </code> |
||
49 | * |
||
50 | * or |
||
51 | * |
||
52 | * <code> |
||
53 | * use Aws\Common\Aws; |
||
54 | * |
||
55 | * // Create a service builder using a configuration file |
||
56 | * $aws = Aws::factory('/path/to/my_config.json'); |
||
57 | * |
||
58 | * // Get the client from the builder by namespace |
||
59 | * $client = $aws->get('Sqs'); |
||
60 | * </code> |
||
61 | * |
||
62 | * More examples see: https://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-sqs.html |
||
63 | * |
||
64 | * |
||
65 | * @see examples/sqs folder |
||
66 | * |
||
67 | * @param AMQPChannel $client |
||
68 | * @param string $queueName |
||
69 | * @param array $queueAttributes |
||
70 | */ |
||
71 | public function __construct(SqsClient $client, $queueName, $queueAttributes = []) |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | public function send(MessageInterface $message) |
||
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | public function wait(Closure $callback) |
||
124 | } |
||
125 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.