| Total Complexity | 5 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | class SupplierUtil |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Supplier constants |
||
| 17 | */ |
||
| 18 | public const DEFAULT_EDGE_SUPPLIER = DefaultEdge::class; |
||
| 19 | public const DEFAULT_WEIGHTED_EDGE_SUPPLIER = DefaultWeightedEdge::class; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Create an edge supplier |
||
| 23 | * |
||
| 24 | * @param string $className - edge class name |
||
| 25 | * |
||
| 26 | * @return SupplierInterface |
||
| 27 | */ |
||
| 28 | 44 | public static function createSupplier(string $className): SupplierInterface |
|
| 29 | { |
||
| 30 | 44 | return new Supplier($className); |
|
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Create a default edge supplier |
||
| 35 | * |
||
| 36 | * @return DefaultEdge |
||
| 37 | */ |
||
| 38 | 1 | public static function createDefaultEdgeSupplier(): SupplierInterface |
|
| 39 | { |
||
| 40 | 1 | return self::createSupplier(DefaultEdge::class); |
|
|
|
|||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Create a default weighted edge supplier |
||
| 45 | * |
||
| 46 | * @return DefaultWeightedEdge |
||
| 47 | */ |
||
| 48 | 1 | public static function createDefaultWeightedEdgeSupplier(): SupplierInterface |
|
| 49 | { |
||
| 50 | 1 | return self::createSupplier(DefaultWeightedEdge::class); |
|
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Create an integer supplier |
||
| 55 | * |
||
| 56 | * @return SupplierInterface |
||
| 57 | */ |
||
| 58 | 1 | public static function createIntegerSupplier(int $start = 0): SupplierInterface |
|
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Create a string supplier |
||
| 65 | * |
||
| 66 | * @return SupplierInterface |
||
| 67 | */ |
||
| 68 | 1 | public static function createStringSupplier(int $start = 0): SupplierInterface |
|
| 71 | } |
||
| 72 | } |
||
| 73 |