Builder   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A newInstance() 0 4 1
1
<?php
2
/**
3
 *
4
 * This file is part of the Aura project for PHP.
5
 *
6
 * @package Aura.Marshal
7
 *
8
 * @license https://opensource.org/licenses/mit-license.php MIT
9
 *
10
 */
11
namespace Aura\Marshal\Collection;
12
13
/**
14
 *
15
 * Creates a new collection object for a type.
16
 *
17
 * @package Aura.Marshal
18
 *
19
 */
20
class Builder implements BuilderInterface
21
{
22
    /**
23
     *
24
     * The class to use for new instances.
25
     *
26
     * @var class-string<GenericCollection>
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<GenericCollection> at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<GenericCollection>.
Loading history...
27
     *
28
     */
29
    protected $class = 'Aura\Marshal\Collection\GenericCollection';
30
31
    /**
32
     *
33
     * Creates a new collection object.
34
     *
35
     * @param array<int|string, mixed> $data Data to load into the collection.
36
     *
37
     * @return GenericCollection
38
     *
39
     */
40
    public function newInstance(array $data)
41
    {
42
        $class = $this->class;
43
        return new $class($data);
44
    }
45
}
46