Core   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 47
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A coreDownload() 0 4 1
A coreInstall() 0 14 1
A coreConfig() 0 15 1
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
        ];
32
33
        CLI::execCommand('core', ['config'], $options);
34
    }
35
36
    /**
37
     * Install WordPress.
38
     */
39
    public static function coreInstall()
40
    {
41
        $config = Configuration::get();
42
        $options = [
43
            'url' => $config['site']['url'],
44
            'title' => $config['site']['title'],
45
            'admin_user' => $config['user']['name'],
46
            'admin_password' => $config['user']['password'],
47
            'admin_email' => $config['user']['email'],
48
            'skip-email' => '',
49
        ];
50
51
        CLI::execCommand('core', ['install'], $options);
52
    }
53
}
54