-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
ClassRepositoryInterface.php
58 lines (50 loc) · 1.26 KB
/
ClassRepositoryInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
declare(strict_types=1);
/*
* UserFrosting Framework (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/framework
* @copyright Copyright (c) 2013-2024 Alexander Weissman, Louis Charette, Jordan Mele
* @license https://github.com/userfrosting/framework/blob/master/LICENSE.md (MIT License)
*/
namespace UserFrosting\Support;
use Countable;
use IteratorAggregate;
/**
* Implements a PHP class repository.
*
* @template T of object
*
* @extends IteratorAggregate<int, T>
*/
interface ClassRepositoryInterface extends Countable, IteratorAggregate
{
/**
* Return all classes.
*
* @return T[] A list of classes instances.
*/
public function all(): array;
/**
* Returns the same list as all, but as a list of class names.
*
* @return class-string[] A list class FQN.
*/
public function list(): array;
/**
* Return the requested class instance from the repository.
*
* @param class-string $class Class FQN.
*
* @return T
*/
public function get(string $class): object;
/**
* Validate if a specific class exist.
*
* @param class-string $class Class FQN.
*
* @return bool
*/
public function has(string $class): bool;
}