| Total Complexity | 7 |
| Total Lines | 78 |
| Duplicated Lines | 0 % |
| Coverage | 96.97% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | final class Metadata |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | public $filename; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var int |
||
| 21 | */ |
||
| 22 | public $lastModifiedAt; |
||
| 23 | |||
| 24 | 18 | private function __construct(string $filename, int $lastModifiedAt) |
|
| 28 | 18 | } |
|
| 29 | |||
| 30 | /** |
||
| 31 | * @return Metadata[] |
||
| 32 | */ |
||
| 33 | 16 | public static function constructFromFixtures(array $fixtures): array |
|
| 34 | { |
||
| 35 | 16 | return static::sortList( |
|
| 36 | 16 | array_map( |
|
| 37 | 16 | function (FixtureInterface $fixture): Metadata { |
|
| 38 | 16 | return static::constructFromReflection(new ReflectionClass($fixture)); |
|
| 39 | 16 | }, |
|
| 40 | 16 | $fixtures |
|
| 41 | ) |
||
| 42 | ); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param ClassMetadata[] $entities |
||
| 47 | * |
||
| 48 | * @return Metadata[] |
||
| 49 | */ |
||
| 50 | 2 | public static function constructFromEntities(array $entities): array |
|
| 51 | { |
||
| 52 | 2 | return static::sortList( |
|
| 53 | 2 | array_map( |
|
| 54 | 2 | function (ClassMetadata $entity): Metadata { |
|
| 55 | 2 | return static::constructFromReflection($entity->getReflectionClass()); |
|
| 56 | 2 | }, |
|
| 57 | 2 | $entities |
|
| 58 | ) |
||
| 59 | ); |
||
| 60 | } |
||
| 61 | |||
| 62 | 18 | private static function constructFromReflection(ReflectionClass $classInfo): self |
|
| 67 | } |
||
| 68 | |||
| 69 | 18 | private static function sortList(array $list): array |
|
| 79 | } |
||
| 80 | |||
| 81 | 18 | private function compare(self $other): int |
|
| 90 | } |
||
| 91 | } |
||
| 92 |