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

ImportWorkspace::handle()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 2
Metric Value
cc 3
eloc 11
c 3
b 1
f 2
nc 3
nop 2
dl 0
loc 19
rs 9.4285
1
<?php
2
namespace SymphonyCms\Installer\Steps;
3
4
use Configuration;
5
use DatabaseException;
6
use Exception;
7
use Symphony;
8
9
class ImportWorkspace extends DefaultStep
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function handle(Configuration $config, array $data)
15
    {
16
        // MySQL: Importing workspace data
17
        $this->logger->info('MYSQL: Importing existing workspace data');
18
19
        if (is_file(WORKSPACE . '/install.sql')) {
20
            try {
21
                Symphony::Database()->import(file_get_contents(WORKSPACE . '/install.sql'));
22
            } catch (DatabaseException $e) {
23
                throw new Exception(sprintf(
24
                    'There was an error while trying to import data to the database. MySQL returned: %s:%s',
25
                    $e->getDatabaseErrorCode(),
26
                    $e->getDatabaseErrorMessage()
27
                ));
28
            }
29
        }
30
31
        return true;
32
    }
33
}
34