Skip to content

Commit

Permalink
Removed unnecessary string operations (#43)
Browse files Browse the repository at this point in the history
Co-authored-by: roxblnfk <[email protected]>
  • Loading branch information
AnrDaemon and roxblnfk authored Jan 21, 2023
1 parent ad0a80c commit 2f358a2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/FileRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private function getFiles(string $directory): \Generator
{
foreach ($this->files->getFiles($directory, '*.php') as $filename) {
$reflection = new ReflectionFile($filename);
$definition = \explode('_', \basename($filename));
$definition = \explode('_', \basename($filename, '.php'), 3);

if (\count($definition) < 3) {
throw new RepositoryException("Invalid migration filename '{$filename}'");
Expand All @@ -152,11 +152,7 @@ private function getFiles(string $directory): \Generator
'class' => $reflection->getClasses()[0],
'created' => $created,
'chunk' => $definition[1],
'name' => \str_replace(
'.php',
'',
\implode('_', \array_slice($definition, 2))
),
'name' => $definition[2],
];
}
}
Expand Down

0 comments on commit 2f358a2

Please sign in to comment.