Skip to content

Commit

Permalink
Make both solution providers pass in their custom title
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRio committed Sep 4, 2019
1 parent 6e32bbd commit 1d56350
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
4 changes: 1 addition & 3 deletions src/SolutionProviders/MissingColumnSolutionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ protected function isBadTableErrorCode($code): bool

public function getSolutions(Throwable $throwable): array
{
$solution = new RunMigrationsSolution('A column was not found');

return [$solution];
return [new RunMigrationsSolution('A column was not found')];
}
}
2 changes: 1 addition & 1 deletion src/SolutionProviders/TableNotFoundSolutionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ protected function isBadTableErrorCode($code): bool

public function getSolutions(Throwable $throwable): array
{
return [new RunMigrationsSolution()];
return [new RunMigrationsSolution('A table was not found')];
}
}
8 changes: 2 additions & 6 deletions src/Solutions/RunMigrationsSolution.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@ class RunMigrationsSolution implements RunnableSolution
{
private $customTitle;

public function __construct($customTitle = null)
public function __construct($customTitle = '')
{
$this->customTitle = $customTitle;
}

public function getSolutionTitle(): string
{
if (isset($this->customTitle)) {
return $this->customTitle;
}

return 'A table was not found';
return $this->customTitle;
}

public function getSolutionDescription(): string
Expand Down

0 comments on commit 1d56350

Please sign in to comment.