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::handle()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 20
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 2
Metric Value
cc 4
eloc 11
c 3
b 1
f 2
nc 3
nop 2
dl 0
loc 20
rs 9.2
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