MetadataProvider::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Happyr\SerializerBundle\Metadata;
4
5
/**
6
 * This is the class that returns the data about the models.
7
 *
8
 * @author Tobias Nyholm <[email protected]>
9
 */
10
class MetadataProvider
11
{
12
    /**
13
     * @var MetadataReader[]
14
     */
15
    private $readers;
16
17
    /**
18
     * @param MetadataReader[] $readers
19
     */
20 24
    public function __construct(array $readers)
21
    {
22 24
        $this->readers = $readers;
23 24
    }
24
25
    /**
26
     * @return Metadata[]
27
     */
28 24
    public function getMetadata()
29
    {
30 24
        $metadata = [];
31 24
        foreach ($this->readers as $reader) {
32 24
            $metadata = array_merge($metadata, $reader->getMetadata());
33 24
        }
34
35 24
        return $metadata;
36
    }
37
}
38