| @@ 8-53 (lines=46) @@ | ||
| 5 | use BeyondCode\SelfDiagnosis\Composer; |
|
| 6 | use BeyondCode\SelfDiagnosis\Checks\Check; |
|
| 7 | ||
| 8 | class ComposerWithDevDependenciesIsUpToDate implements Check |
|
| 9 | { |
|
| 10 | /** @var Composer */ |
|
| 11 | private $composer; |
|
| 12 | ||
| 13 | /** @var string */ |
|
| 14 | private $output; |
|
| 15 | ||
| 16 | public function __construct(Composer $composer) |
|
| 17 | { |
|
| 18 | $this->composer = $composer; |
|
| 19 | $this->composer->setWorkingPath(base_path()); |
|
| 20 | } |
|
| 21 | ||
| 22 | /** |
|
| 23 | * The name of the check. |
|
| 24 | * |
|
| 25 | * @return string |
|
| 26 | */ |
|
| 27 | public function name(): string |
|
| 28 | { |
|
| 29 | return 'Composer dependencies are up to date'; |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Perform the actual verification of this check. |
|
| 34 | * |
|
| 35 | * @return bool |
|
| 36 | */ |
|
| 37 | public function check(): bool |
|
| 38 | { |
|
| 39 | $this->output = $this->composer->installDryRun(); |
|
| 40 | ||
| 41 | return str_contains($this->output, 'Nothing to install or update'); |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * The error message to display in case the check does not pass. |
|
| 46 | * |
|
| 47 | * @return string |
|
| 48 | */ |
|
| 49 | public function message() : string |
|
| 50 | { |
|
| 51 | return 'Your composer dependencies are not up to date. Call "composer install".' . $this->output; |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| @@ 8-53 (lines=46) @@ | ||
| 5 | use BeyondCode\SelfDiagnosis\Composer; |
|
| 6 | use BeyondCode\SelfDiagnosis\Checks\Check; |
|
| 7 | ||
| 8 | class ComposerWithoutDevDependenciesIsUpToDate implements Check |
|
| 9 | { |
|
| 10 | /** @var Composer */ |
|
| 11 | private $composer; |
|
| 12 | ||
| 13 | /** @var string */ |
|
| 14 | private $output; |
|
| 15 | ||
| 16 | public function __construct(Composer $composer) |
|
| 17 | { |
|
| 18 | $this->composer = $composer; |
|
| 19 | $this->composer->setWorkingPath(base_path()); |
|
| 20 | } |
|
| 21 | ||
| 22 | /** |
|
| 23 | * The name of the check. |
|
| 24 | * |
|
| 25 | * @return string |
|
| 26 | */ |
|
| 27 | public function name(): string |
|
| 28 | { |
|
| 29 | return 'Composer dependencies (without dev) are up to date'; |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Perform the actual verification of this check. |
|
| 34 | * |
|
| 35 | * @return bool |
|
| 36 | */ |
|
| 37 | public function check(): bool |
|
| 38 | { |
|
| 39 | $this->output = $this->composer->installDryRun('--no-dev'); |
|
| 40 | ||
| 41 | return str_contains($this->output, 'Nothing to install or update'); |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * The error message to display in case the check does not pass. |
|
| 46 | * |
|
| 47 | * @return string |
|
| 48 | */ |
|
| 49 | public function message() : string |
|
| 50 | { |
|
| 51 | return 'Your composer dependencies are not up to date. Call "composer install".' . $this->output; |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||