Passed
Push — master ( a5e8db...945884 )
by Danny
02:33
created

Core::coreInstall()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace PressCLI\WPCLI;
3
4
use PressCLI\WPCLI\CLI;
5
use PressCLI\Option\Configuration;
6
7
trait Core
8
{
9
    /**
10
     * Downloads WordPress core.
11
     */
12
    public static function coreDownload()
13
    {
14
        CLI::execCommand('core', ['download']);
15
    }
16
17
    /**
18
     * Creates the wp-config.php
19
     */
20
    public static function coreConfig()
21
    {
22
        $config = Configuration::get();
23
        $dbConfig = $config['database'];
24
        $options = [
25
            'skip-check' => '',
26
            'dbuser' => $dbConfig['user'],
27
            'dbpass' => $dbConfig['password'],
28
            'dbprefix' => $dbConfig['prefix'],
29
            'dbname' => $dbConfig['name'],
30
            'dbhost' => $dbConfig['host'],
31
            // 'extra-php' => "define( 'WP_DEBUG', true );\ndefine( 'WP_DEBUG_LOG', true );",
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
32
        ];
33
34
        CLI::execCommand('core', ['config'], $options);
35
    }
36
37
    /**
38
     * Install WordPress.
39
     */
40
    public static function coreInstall()
41
    {
42
        $config = Configuration::get();
43
        $options = [
44
            'url' => $config['site']['url'],
45
            'title' => $config['site']['title'],
46
            'admin_user' => $config['user']['name'],
47
            'admin_password' => $config['user']['password'],
48
            'admin_email' => $config['user']['email'],
49
            'skip-email' => '',
50
        ];
51
52
        CLI::execCommand('core', ['install'], $options);
53
    }
54
}
55