@@ 8-60 (lines=53) @@ | ||
5 | use BeyondCode\SelfDiagnosis\Composer; |
|
6 | use Illuminate\Support\Arr; |
|
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 | * @param array $config |
|
26 | * @return string |
|
27 | */ |
|
28 | public function name(array $config): string |
|
29 | { |
|
30 | return trans('self-diagnosis::checks.composer_with_dev_dependencies_is_up_to_date.name'); |
|
31 | } |
|
32 | ||
33 | /** |
|
34 | * Perform the actual verification of this check. |
|
35 | * |
|
36 | * @param array $config |
|
37 | * @return bool |
|
38 | */ |
|
39 | public function check(array $config): bool |
|
40 | { |
|
41 | $additionalOptions = Arr::get($config, 'additional_options', ''); |
|
42 | ||
43 | $this->output = $this->composer->installDryRun($additionalOptions); |
|
44 | ||
45 | return str_contains($this->output, 'Nothing to install or update'); |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * The error message to display in case the check does not pass. |
|
50 | * |
|
51 | * @param array $config |
|
52 | * @return string |
|
53 | */ |
|
54 | public function message(array $config): string |
|
55 | { |
|
56 | return trans('self-diagnosis::checks.composer_with_dev_dependencies_is_up_to_date.message', [ |
|
57 | 'more' => $this->output, |
|
58 | ]); |
|
59 | } |
|
60 | } |
|
61 |
@@ 8-60 (lines=53) @@ | ||
5 | use BeyondCode\SelfDiagnosis\Composer; |
|
6 | use Illuminate\Support\Arr; |
|
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 | * @param array $config |
|
26 | * @return string |
|
27 | */ |
|
28 | public function name(array $config): string |
|
29 | { |
|
30 | return trans('self-diagnosis::checks.composer_without_dev_dependencies_is_up_to_date.name'); |
|
31 | } |
|
32 | ||
33 | /** |
|
34 | * Perform the actual verification of this check. |
|
35 | * |
|
36 | * @param array $config |
|
37 | * @return bool |
|
38 | */ |
|
39 | public function check(array $config): bool |
|
40 | { |
|
41 | $additionalOptions = Arr::get($config, 'additional_options', ''); |
|
42 | ||
43 | $this->output = $this->composer->installDryRun('--no-dev ' . $additionalOptions); |
|
44 | ||
45 | return str_contains($this->output, 'Nothing to install or update'); |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * The error message to display in case the check does not pass. |
|
50 | * |
|
51 | * @param array $config |
|
52 | * @return string |
|
53 | */ |
|
54 | public function message(array $config): string |
|
55 | { |
|
56 | return trans('self-diagnosis::checks.composer_without_dev_dependencies_is_up_to_date.message', [ |
|
57 | 'more' => $this->output, |
|
58 | ]); |
|
59 | } |
|
60 | } |
|
61 |