| Total Complexity | 6 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 14 | class Autoloader |
||
| 15 | { |
||
| 16 | /** @var TypeDissector */ |
||
| 17 | private $dissector; |
||
| 18 | /** @var Loader */ |
||
| 19 | private $loader; |
||
| 20 | /** @var LoggerInterface */ |
||
| 21 | private $log; |
||
| 22 | |||
| 23 | public function __construct( |
||
| 24 | TypeDissector $dissector, |
||
| 25 | Loader $loader, |
||
| 26 | LoggerInterface $log |
||
| 27 | ) { |
||
| 28 | $this->dissector = $dissector; |
||
| 29 | $this->loader = $loader; |
||
| 30 | $this->log = $log; |
||
| 31 | } |
||
| 32 | |||
| 33 | /** @throws AnnotationException */ |
||
| 34 | public static function default(): self |
||
| 35 | { |
||
| 36 | return new self( |
||
| 37 | MagicTypeDissector::default(), |
||
| 38 | Loader::default(), |
||
| 39 | new NullLogger() |
||
| 40 | ); |
||
| 41 | } |
||
| 42 | |||
| 43 | public function install(): void |
||
| 44 | { |
||
| 45 | spl_autoload_register([$this, 'load']); |
||
| 46 | } |
||
| 47 | |||
| 48 | public function uninstall(): void |
||
| 49 | { |
||
| 50 | spl_autoload_unregister([$this, 'load']); |
||
| 51 | } |
||
| 52 | |||
| 53 | public function load(string $class): void |
||
| 60 | ); |
||
| 61 | } |
||
| 62 | } |
||
| 63 | } |
||
| 64 |