Skip to content

Commit

Permalink
Merge pull request #42 from stijnbernards/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
tdgroot authored Mar 5, 2024
2 parents 6ee3d07 + 3119810 commit 0caa36f
Showing 1 changed file with 36 additions and 12 deletions.
48 changes: 36 additions & 12 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,15 @@ private function validateTask(string $task): bool
return true;
}

public function addBuildTask(string $task): void
public function addBuildTask(string $task): self
{
if ($this->validateTask($task)) {
$this->buildTasks[] = $task;
} else {
throw new \RuntimeException(sprintf("Build task %s does not exist!", $task));
}

return $this;
}

/**
Expand All @@ -199,13 +201,15 @@ public function getBuildTasks(): array
return $this->buildTasks;
}

public function addDeployTask(string $task): void
public function addDeployTask(string $task): self
{
if ($this->validateTask($task)) {
$this->deployTasks[] = $task;
} else {
throw new \RuntimeException(sprintf("Deploy task %s does not exist!", $task));
}

return $this;
}

/**
Expand Down Expand Up @@ -244,14 +248,18 @@ public function addStage(string $name, string $domain, string $username = 'app')
* @param string[] $options
* @return void
*/
public function setComposerOptions(array $options): void
public function setComposerOptions(array $options): self
{
$this->setVariable('composer_options', implode(' ', $options));

return $this;
}

public function setDefaultComposerOptions(): void
public function setDefaultComposerOptions(): self
{
$this->setComposerOptions(self::DEFAULT_COMPOSER_OPTIONS);

return $this;
}

/**
Expand Down Expand Up @@ -331,12 +339,14 @@ public function addWritableFolder(string $folder): self
/**
* @param string[] $writableFolders
*/
public function setWritableFolders(array $writableFolders): void
public function setWritableFolders(array $writableFolders): self
{
$this->writableFolders = [];
foreach ($writableFolders as $folder) {
$this->addWritableFolder($folder);
}

return $this;
}

/**
Expand Down Expand Up @@ -426,44 +436,54 @@ public function getPhpVersion(): string
return $this->phpVersion;
}

public function setPhpVersion(string $phpVersion): void
public function setPhpVersion(string $phpVersion): self
{
$this->phpVersion = $phpVersion;

return $this;
}

public function getPublicFolder(): string
{
return $this->publicFolder;
}

public function setPublicFolder(string $publicFolder): void
public function setPublicFolder(string $publicFolder): self
{
$this->publicFolder = $publicFolder;

return $this;
}

public function getPostInitializeCallbacks(): array
{
return $this->postInitializeCallbacks;
}

public function setPostInitializeCallbacks(array $callbacks): void
public function setPostInitializeCallbacks(array $callbacks): self
{
$this->postInitializeCallbacks = $callbacks;

return $this;
}

public function addPostInitializeCallback(callable $callback)
public function addPostInitializeCallback(callable $callback): self
{
$this->postInitializeCallbacks[] = $callback;

return $this;
}

public function getBuildArchiveFile(): string
{
return $this->buildArchiveFile;
}

public function setBuildArchiveFile(string $buildArchiveFile): void
public function setBuildArchiveFile(string $buildArchiveFile): self
{
$this->buildArchiveFile = $buildArchiveFile;

return $this;
}

public function getLogDir(): string
Expand All @@ -474,18 +494,22 @@ public function getLogDir(): string
/**
* Directory containing log files
*/
public function setLogDir(string $logDir): void
public function setLogDir(string $logDir): self
{
$this->logDir = $logDir;

return $this;
}

public function getLogger(): LoggerInterface
{
return $this->logger;
}

public function setLogger(LoggerInterface $logger): void
public function setLogger(LoggerInterface $logger): self
{
$this->logger = $logger;

return $this;
}
}

0 comments on commit 0caa36f

Please sign in to comment.