|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +use Steevanb\PhpCollection\{ |
| 6 | + Maker\ObjectCollectionMaker, |
| 7 | + Maker\ObjectNullableCollectionMaker |
| 8 | +}; |
| 9 | + |
| 10 | +$rootPath = dirname(__DIR__, 2); |
| 11 | + |
| 12 | +require $rootPath . '/vendor/autoload.php'; |
| 13 | + |
| 14 | +$maker = new ObjectCollectionMaker(); |
| 15 | +$nullableMaker = new ObjectNullableCollectionMaker(); |
| 16 | +$collectionPath = $rootPath . '/src/ObjectCollection'; |
| 17 | +$collectionNamespace = 'Steevanb\\PhpCollection\\ObjectCollection'; |
| 18 | + |
| 19 | +$interfaces = [ |
| 20 | + '\\' . BackedEnum::class, |
| 21 | + '\\' . Countable::class, |
| 22 | + '\\' . DateTimeInterface::class, |
| 23 | + '\\' . JsonSerializable::class, |
| 24 | + '\\' . Serializable::class, |
| 25 | + '\\' . Stringable::class, |
| 26 | + '\\' . UnitEnum::class |
| 27 | +]; |
| 28 | + |
| 29 | +foreach ($interfaces as $interface) { |
| 30 | + echo 'Generate collection for ' . $interface . '.' . "\n"; |
| 31 | + $maker->make($interface, $collectionPath, $collectionNamespace); |
| 32 | + |
| 33 | + echo 'Generate nullable collection for ' . $interface . '.' . "\n"; |
| 34 | + $nullableMaker->make($interface, $collectionPath, $collectionNamespace); |
| 35 | +} |
| 36 | + |
| 37 | +$classes = [ |
| 38 | + '\\' . DateInterval::class, |
| 39 | + '\\' . DatePeriod::class, |
| 40 | + '\\' . DateTime::class, |
| 41 | + '\\' . DateTimeImmutable::class, |
| 42 | + '\\' . DateTimeZone::class, |
| 43 | + '\\' . Reflection::class, |
| 44 | + '\\' . ReflectionAttribute::class, |
| 45 | + '\\' . ReflectionClass::class, |
| 46 | + '\\' . ReflectionClassConstant::class, |
| 47 | + '\\' . ReflectionEnum::class, |
| 48 | + '\\' . ReflectionEnumBackedCase::class, |
| 49 | + '\\' . ReflectionEnumUnitCase::class, |
| 50 | + '\\' . ReflectionExtension::class, |
| 51 | + '\\' . ReflectionFiber::class, |
| 52 | + '\\' . ReflectionFunction::class, |
| 53 | + '\\' . ReflectionFunctionAbstract::class, |
| 54 | + '\\' . ReflectionGenerator::class, |
| 55 | + '\\' . ReflectionIntersectionType::class, |
| 56 | + '\\' . ReflectionMethod::class, |
| 57 | + '\\' . ReflectionNamedType::class, |
| 58 | + '\\' . ReflectionObject::class, |
| 59 | + '\\' . ReflectionParameter::class, |
| 60 | + '\\' . ReflectionProperty::class, |
| 61 | + '\\' . ReflectionReference::class, |
| 62 | + '\\' . ReflectionType::class, |
| 63 | + '\\' . ReflectionUnionType::class, |
| 64 | + '\\' . SplFileInfo::class, |
| 65 | + '\\' . SplFileObject::class, |
| 66 | + '\\' . stdClass::class |
| 67 | +]; |
| 68 | + |
| 69 | +foreach ($classes as $class) { |
| 70 | + echo 'Generate collection for ' . $class . '.' . "\n"; |
| 71 | + $maker->make($class, $collectionPath, $collectionNamespace); |
| 72 | + |
| 73 | + echo 'Generate nullable collection for ' . $class . '.' . "\n"; |
| 74 | + $nullableMaker->make($class, $collectionPath, $collectionNamespace); |
| 75 | +} |
0 commit comments