These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace BeyondCode\SelfDiagnosis\Checks; |
||
4 | |||
5 | use BeyondCode\SelfDiagnosis\Composer; |
||
6 | use Illuminate\Support\Arr; |
||
7 | |||
8 | View Code Duplication | 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'); |
||
0 ignored issues
–
show
|
|||
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 |
This function has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.