Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace DI\Attribute;
6
 
7
use Attribute;
8
 
9
/**
10
 * "Injectable" attribute.
11
 *
12
 * Marks a class as injectable
13
 *
14
 * @api
15
 *
16
 * @author Domenic Muskulus <domenic@muskulus.eu>
17
 * @author Matthieu Napoli <matthieu@mnapoli.fr>
18
 */
19
#[Attribute(Attribute::TARGET_CLASS)]
20
final class Injectable
21
{
22
    /**
23
     * @param bool|null $lazy Should the object be lazy-loaded.
24
     */
25
    public function __construct(
26
        private ?bool $lazy = null,
27
    ) {
28
    }
29
 
30
    public function isLazy() : bool|null
31
    {
32
        return $this->lazy;
33
    }
34
}