Skip to content

Commit

Permalink
Export: instead of loading all schema files, load only schema files t…
Browse files Browse the repository at this point in the history
…hat are used, when they are used
  • Loading branch information
chlulei committed Dec 2, 2024
1 parent df127fc commit 0fd7a0b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

interface HandlerInterface
{
public function withSplFileInfo(
SplFileInfo $spl_file_info
): HandlerInterface;
public function withFilePath(
string $file_path
);

public function withComponent(
string $component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private function readSchemaFiles(): void
continue;
}
$element = $this->import_handler->schema()->info()->handler()
->withSplFileInfo(new SplFileInfo($file->getPathname()))
->withFilePath($file->getPathname())
->withComponent((string) $matches[1])
->withSubtype((string) $matches[3])
->withVersion(new Version($matches[4] . (($matches[6] ?? '') ? '.' . $matches[6] : '')));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@ class Handler implements SchemaInfoInterface
private string $component;

private string $sub_type;
private string $file_path;

private SplFileInfo $file;

public function withSplFileInfo(
SplFileInfo $spl_file_info
): SchemaInfoInterface {
public function withFilePath(
string $file_path
) {
$clone = clone $this;
$clone->file = $spl_file_info;
$clone->file_path = $file_path;
return $clone;
}

Expand Down Expand Up @@ -68,7 +67,7 @@ public function withVersion(

public function getFile(): SplFileInfo
{
return $this->file;
return new SplFileInfo($this->file_path);
}

public function getComponent(): string
Expand Down

0 comments on commit 0fd7a0b

Please sign in to comment.