Passed
Pull Request — master (#50)
by Tilita
18:37
created

EntityArgumentsInterpreter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 14
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A interpretArguments() 0 6 2
1
<?php
2
3
namespace NeedleProject\LaravelRabbitMq\Interpreter;
4
5
use PhpAmqpLib\Wire\AMQPTable;
6
7
class EntityArgumentsInterpreter
8
{
9
    /**
10
     * For a accurate usage, please reffer to https://www.rabbitmq.com/queues.html#optional-arguments
11
     *
12
     * @param AMQPTable|array $entityArguments
13
     * @return AMQPTable
14
     */
15
    public static function interpretArguments($entityArguments): AMQPTable
16
    {
17
        if ($entityArguments instanceof AMQPTable) {
18
            return $entityArguments;
19
        }
20
        return new AMQPTable($entityArguments);
21
    }
22
}
23