Completed
Pull Request — master (#14)
by Саша
02:04
created

MessageLoader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 5
Bugs 1 Features 0
Metric Value
c 5
b 1
f 0
dl 0
loc 20
wmc 3
lcom 1
cbo 2
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A load() 0 10 2
1
<?php
2
3
namespace Extraload\Loader;
4
5
use Extraload\Loader\LoaderInterface;
6
7
class MessageLoader extends AutoFlushLoader implements LoaderInterface
8
{
9
    private $loader;
10
11
    public function __construct(LoaderInterface $loader)
12
    {
13
        $this->loader = $loader;
14
    }
15
16
    public function load($data = null)
17
    {
18
        if (!$data instanceof \AMQPEnvelope) {
19
            throw new \InvalidArgumentException('MessageLoader can only load AMQPEnvelope.');
20
        }
21
22
        $this->loader->load(unserialize($data->getBody()));
23
24
        $this->loader->flush();
25
    }
26
}
27