@@ 7-59 (lines=53) @@ | ||
4 | ||
5 | use BeyondCode\SelfDiagnosis\Composer; |
|
6 | ||
7 | class ComposerWithDevDependenciesIsUpToDate implements Check |
|
8 | { |
|
9 | /** @var Composer */ |
|
10 | private $composer; |
|
11 | ||
12 | /** @var string */ |
|
13 | private $output; |
|
14 | ||
15 | public function __construct(Composer $composer) |
|
16 | { |
|
17 | $this->composer = $composer; |
|
18 | $this->composer->setWorkingPath(base_path()); |
|
19 | } |
|
20 | ||
21 | /** |
|
22 | * The name of the check. |
|
23 | * |
|
24 | * @param array $config |
|
25 | * @return string |
|
26 | */ |
|
27 | public function name(array $config): string |
|
28 | { |
|
29 | return trans('self-diagnosis::checks.composer_with_dev_dependencies_is_up_to_date.name'); |
|
30 | } |
|
31 | ||
32 | /** |
|
33 | * Perform the actual verification of this check. |
|
34 | * |
|
35 | * @param array $config |
|
36 | * @return bool |
|
37 | */ |
|
38 | public function check(array $config): bool |
|
39 | { |
|
40 | $additionalOptions = array_get($config, 'additional_options', ''); |
|
41 | ||
42 | $this->output = $this->composer->installDryRun($additionalOptions); |
|
43 | ||
44 | return str_contains($this->output, 'Nothing to install or update'); |
|
45 | } |
|
46 | ||
47 | /** |
|
48 | * The error message to display in case the check does not pass. |
|
49 | * |
|
50 | * @param array $config |
|
51 | * @return string |
|
52 | */ |
|
53 | public function message(array $config): string |
|
54 | { |
|
55 | return trans('self-diagnosis::checks.composer_with_dev_dependencies_is_up_to_date.message', [ |
|
56 | 'more' => $this->output, |
|
57 | ]); |
|
58 | } |
|
59 | } |
|
60 |
@@ 7-59 (lines=53) @@ | ||
4 | ||
5 | use BeyondCode\SelfDiagnosis\Composer; |
|
6 | ||
7 | class ComposerWithoutDevDependenciesIsUpToDate implements Check |
|
8 | { |
|
9 | /** @var Composer */ |
|
10 | private $composer; |
|
11 | ||
12 | /** @var string */ |
|
13 | private $output; |
|
14 | ||
15 | public function __construct(Composer $composer) |
|
16 | { |
|
17 | $this->composer = $composer; |
|
18 | $this->composer->setWorkingPath(base_path()); |
|
19 | } |
|
20 | ||
21 | /** |
|
22 | * The name of the check. |
|
23 | * |
|
24 | * @param array $config |
|
25 | * @return string |
|
26 | */ |
|
27 | public function name(array $config): string |
|
28 | { |
|
29 | return trans('self-diagnosis::checks.composer_without_dev_dependencies_is_up_to_date.name'); |
|
30 | } |
|
31 | ||
32 | /** |
|
33 | * Perform the actual verification of this check. |
|
34 | * |
|
35 | * @param array $config |
|
36 | * @return bool |
|
37 | */ |
|
38 | public function check(array $config): bool |
|
39 | { |
|
40 | $additionalOptions = array_get($config, 'additional_options', ''); |
|
41 | ||
42 | $this->output = $this->composer->installDryRun('--no-dev ' . $additionalOptions); |
|
43 | ||
44 | return str_contains($this->output, 'Nothing to install or update'); |
|
45 | } |
|
46 | ||
47 | /** |
|
48 | * The error message to display in case the check does not pass. |
|
49 | * |
|
50 | * @param array $config |
|
51 | * @return string |
|
52 | */ |
|
53 | public function message(array $config): string |
|
54 | { |
|
55 | return trans('self-diagnosis::checks.composer_without_dev_dependencies_is_up_to_date.message', [ |
|
56 | 'more' => $this->output, |
|
57 | ]); |
|
58 | } |
|
59 | } |
|
60 |