Skip to content

Commit

Permalink
Merge pull request #76 from neighborhoods/BUPH-143-api-objects-and-du…
Browse files Browse the repository at this point in the history
…mper

BUPH-143 | make API Dumper basePath optional
  • Loading branch information
jpmarcotte authored Feb 18, 2022
2 parents aaf0c67 + c67a475 commit 78e5670
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/V1/Api/Dumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ class Dumper implements DumperInterface
/** @var string */
private $basePath;

public function __construct(string $basePath)
public function __construct(?string $basePath = null)
{
$this->setBasePath($basePath);

$this->setFilesystem(new Filesystem());
if ($basePath) {
$this->setBasePath($basePath);
}
}

public function dumpFile(FabricationFileInterface $fabricationFile): Dumper
Expand Down Expand Up @@ -54,15 +54,10 @@ public function dump(FabricationFileInterface $fabricationFile): string
return Yaml\Yaml::dump($data, PHP_INT_MAX, 2);
}

public function setFilesystem(Filesystem $filesystem): void
{
$this->filesystem = $filesystem;
}

private function getFilesystem(): Filesystem
{
if ($this->filesystem === null) {
throw new \LogicException('Dumper filesystem has not been set.');
$this->filesystem = new Filesystem();
}

return $this->filesystem;
Expand Down

0 comments on commit 78e5670

Please sign in to comment.