Conditions | 4 |
Paths | 16 |
Total Lines | 60 |
Code Lines | 43 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
69 | protected function execute(InputInterface $input, OutputInterface $output): int |
||
70 | { |
||
71 | $io = new SymfonyStyle(input: $input, output: $output); |
||
72 | |||
73 | $data = |
||
74 | '; <?php return; ?> DO NOT DELETE THIS LINE' . PHP_EOL; |
||
75 | |||
76 | $config = [ |
||
77 | 'dbtype' => $input->getOption(name: 'dbtype'), |
||
78 | 'dbhost' => $input->getOption(name: 'dbhost'), |
||
79 | 'dbport' => $input->getOption(name: 'dbport'), |
||
80 | 'dbuser' => $input->getOption(name: 'dbuser'), |
||
81 | 'dbpass' => $input->getOption(name: 'dbpass'), |
||
82 | 'dbname' => $input->getOption(name: 'dbname'), |
||
83 | 'dbkey' => $input->getOption(name: 'dbkey'), |
||
84 | 'dbcert' => $input->getOption(name: 'dbcert'), |
||
85 | 'dbca' => $input->getOption(name: 'dbca'), |
||
86 | 'dbverify' => (int) (bool) $input->getOption(name: 'dbverify'), |
||
87 | 'tblpfx' => $input->getOption(name: 'tblpfx'), |
||
88 | 'base_url' => rtrim(string: $input->getOption(name: 'base-url'), characters: '/'), |
||
89 | 'rewrite_urls' => (int) (bool) $input->getOption(name: 'rewrite-urls'), |
||
90 | 'block_asn' => $input->getOption(name: 'block-asn'), |
||
91 | ]; |
||
92 | |||
93 | foreach ($config as $key => $value) { |
||
94 | $data .= $key . ' = "' . addcslashes(string: (string) $value, characters: '"') . '"' . PHP_EOL; |
||
95 | } |
||
96 | |||
97 | $io->info(message: $data); |
||
98 | file_put_contents(filename: Webtrees::CONFIG_FILE, data: $data); |
||
99 | |||
100 | if ($input->getOption(name: 'base-url') === '') { |
||
101 | $io->warning(message: 'You must set the base URL'); |
||
102 | } |
||
103 | |||
104 | try { |
||
105 | $config = parse_ini_file(filename: Webtrees::CONFIG_FILE); |
||
106 | |||
107 | DB::connect( |
||
108 | driver: $config['dbtype'], |
||
109 | host: $config['dbhost'], |
||
110 | port: $config['dbport'], |
||
111 | database: $config['dbname'], |
||
112 | username: $config['dbuser'], |
||
113 | password: $config['dbpass'], |
||
114 | prefix: $config['tblpfx'], |
||
115 | key: $config['dbkey'], |
||
116 | certificate: $config['dbcert'], |
||
117 | ca: $config['dbca'], |
||
118 | verify_certificate: (bool) $config['dbverify'], |
||
119 | ); |
||
120 | |||
121 | $io->success(message: 'Database connection successful'); |
||
122 | } catch (Throwable $ex) { |
||
123 | $io->error(message: 'Database connection failed: ' . $ex->getMessage()); |
||
124 | |||
125 | return Command::FAILURE; |
||
126 | } |
||
127 | |||
128 | return Command::SUCCESS; |
||
129 | } |
||
131 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths