core/Config.php

### Summary

A
2 hrs
A
100%

#### Function `toArray` has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open

``````    public function toArray(\$envs = [])
{
\$config = [];
\$envs = (array) \$envs;
\$envs = array_merge(\$envs, [self::ENV_ALL]);``````
Found in core/Config.php - About 1 hr to fix

# Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

### A method's cognitive complexity is based on a few simple rules:

• Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
• Code is considered more complex for each "break in the linear flow of the code"
• Code is considered more complex when "flow breaking structures are nested"

#### Function `appendConfig` has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open

``````    private function appendConfig(&\$config, ConfigDefinition \$definition)
{
switch (\$definition->getGroup()) {
case ConfigDefinition::GROUP_APPLICATIONS:
foreach (\$definition->getConfig() as \$k => \$v) {``````
Found in core/Config.php - About 55 mins to fix

# Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

### A method's cognitive complexity is based on a few simple rules:

• Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
• Code is considered more complex for each "break in the linear flow of the code"
• Code is considered more complex when "flow breaking structures are nested"
{"ft_lang_label":"__label__en","ft_lang_prob":0.8710684,"math_prob":0.81880504,"size":1888,"snap":"2021-43-2021-49","text_gpt3_token_len":397,"char_repetition_ratio":0.14543524,"word_repetition_ratio":0.77304965,"special_character_ratio":0.2065678,"punctuation_ratio":0.08305648,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9552093,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-10-17T11:40:28Z\",\"WARC-Record-ID\":\"<urn:uuid:084c021f-a60f-4ebe-8c7e-e1d39bfb8fad>\",\"Content-Length\":\"18634\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b51c258d-4095-4dc4-a73d-1ab16fbae137>\",\"WARC-Concurrent-To\":\"<urn:uuid:b2d02238-4747-472f-ac26-685d92a873ac>\",\"WARC-IP-Address\":\"52.54.158.66\",\"WARC-Target-URI\":\"https://codeclimate.com/github/luyadev/luya/core/Config.php\",\"WARC-Payload-Digest\":\"sha1:ZPMZDQRTHGPMA53BVCO4THPDULUGE5GS\",\"WARC-Block-Digest\":\"sha1:DEIZT2Z6Z453F4IVOEYGHMX2C4F7ZXMM\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-43/CC-MAIN-2021-43_segments_1634323585177.11_warc_CC-MAIN-20211017113503-20211017143503-00065.warc.gz\"}"}