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

CreateWorkspace::handle()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 18
Code Lines 10

Duplication

Lines 6
Ratio 33.33 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
cc 3
eloc 10
c 2
b 1
f 1
nc 3
nop 2
dl 6
loc 18
rs 9.4285
1
<?php
2
namespace SymphonyCms\Installer\Steps;
3
4
use Configuration;
5
use Exception;
6
use General;
7
8
class CreateWorkspace extends DefaultStep
9
{
10
    /**
11
     * Return the directories that should be created.
12
     *
13
     * @return array
14
     */
15
    public function getWorkspaceDirectories()
16
    {
17
        return [
18
            'workspace'     => WORKSPACE,
19
            'data-sources'  => DATASOURCES,
20
            'events'        => EVENTS,
21
            'pages'         => PAGES,
22
            'utilities'     => UTILITIES
23
        ];
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function handle(Configuration $config, array $data)
30
    {
31
        foreach ($this->getWorkspaceDirectories() as $name => $dir) {
32
            $this->logger->info(sprintf(
33
                'WRITING: Creating ‘%s‘ folder',
34
                $name
35
            ));
36
37 View Code Duplication
            if (!General::realiseDirectory($dir, $config->get('write_mode', 'directory'))) {
0 ignored issues
show
Documentation introduced by
$config->get('write_mode', 'directory') is of type array|string, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
38
                throw new Exception(sprintf(
39
                    'Could not create ‘%s’ directory. Check permission on the root folder.',
40
                    $name
41
                ));
42
            }
43
        }
44
45
        return true;
46
    }
47
}
48