GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — integration (#2604)
by Brendan
04:35
created

EnableLanguage   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 0
loc 26
rs 10
wmc 4
lcom 0
cbo 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 20 4
1
<?php
2
namespace SymphonyCms\Installer\Steps;
3
4
use Configuration;
5
use ExtensionManager;
6
use Lang;
7
8
class EnableLanguage extends DefaultStep
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function handle(Configuration $config, array $data)
14
    {
15
        // Loading default language
16
        if (isset($_REQUEST['lang']) && $_REQUEST['lang'] !== 'en') {
17
            $this->logger->info('CONFIGURING: Default language');
18
19
            $language = Lang::Languages();
20
            $language = $language[$_REQUEST['lang']];
21
22
            // Is the language extension enabled?
23
            if (in_array('lang_' . $language['handle'], ExtensionManager::listInstalledHandles())) {
24
                $config->set('lang', $_REQUEST['lang'], 'symphony');
25
            } else {
26
                $this->logger->warning('Could not enable the desired language ‘' . $language['name'] . '’.');
27
                return false;
28
            }
29
        }
30
31
        return true;
32
    }
33
}
34