| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 24 | 
| Code Lines | 16 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 19 | 
| CRAP Score | 2 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 13 | 3 | public static function build($routingKey, Body $body = null, array $additionalHeaders = [], array $additionalAttributes = [])  | 
            |
| 14 |     { | 
            ||
| 15 | 3 | if(! $body instanceof Body)  | 
            |
| 16 | 3 |         { | 
            |
| 17 | 1 | $body = new NullBody();  | 
            |
| 18 | 1 | }  | 
            |
| 19 | |||
| 20 | 3 | $attributes = array_merge([  | 
            |
| 21 | 3 | 'content_type' => $body->getContentType(),  | 
            |
| 22 | 3 | 'routing_key' => $routingKey,  | 
            |
| 23 | 3 | 'content_encoding' => 'utf8',  | 
            |
| 24 | 3 | 'message_id' => uniqid(true),  | 
            |
| 25 | 3 | ], $additionalAttributes);  | 
            |
| 26 | |||
| 27 | 3 | $attributes['headers'] = array_merge([  | 
            |
| 28 | 3 | 'routing_key' => $routingKey,  | 
            |
| 29 | 3 | 'app_id' => 'memory',  | 
            |
| 30 | 3 |             'message_datetime' => date('Y-m-d H:i:s'), | 
            |
| 31 | 3 | ], $additionalHeaders);  | 
            |
| 32 | |||
| 33 | 3 | return new MessageAdapter(  | 
            |
| 34 | 3 | new \Swarrot\Broker\Message($body->format(), $attributes)  | 
            |
| 35 | 3 | );  | 
            |
| 36 | }  | 
            ||
| 37 | }  | 
            ||
| 38 |