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\Lazy; |
||
12 | |||
13 | use Aura\Marshal\Relation\RelationInterface; |
||
14 | |||
15 | /** |
||
16 | * |
||
17 | * A builder for Lazy objects. |
||
18 | * |
||
19 | * @package Aura.Marshal |
||
20 | * |
||
21 | */ |
||
22 | class Builder implements BuilderInterface |
||
23 | { |
||
24 | /** |
||
25 | * |
||
26 | * The class to use for new instances. |
||
27 | * |
||
28 | * @var class-string<LazyInterface> |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
29 | * |
||
30 | */ |
||
31 | protected $class = 'Aura\Marshal\Lazy\GenericLazy'; |
||
32 | |||
33 | /** |
||
34 | * |
||
35 | * Creates a new Lazy object. |
||
36 | * |
||
37 | * @param RelationInterface $relation The relationship object between the |
||
38 | * native and foreign types. |
||
39 | * |
||
40 | * @return LazyInterface |
||
41 | * |
||
42 | */ |
||
43 | public function newInstance(RelationInterface $relation) |
||
44 | { |
||
45 | $class = $this->class; |
||
46 | return new $class($relation); |
||
47 | } |
||
48 | } |
||
49 |