Issues (151)

src/models/Settings.php (21 issues)

1
<?php
2
/**
3
 * Connect plugin for Craft CMS 3.x
4
 *
5
 * Allows you to connect to external databases and perform db queries
6
 *
7
 * @link      https://nystudio107.com/
0 ignored issues
show
The tag in position 1 should be the @copyright tag
Loading history...
8
 * @copyright Copyright (c) 2018 nystudio107
0 ignored issues
show
@copyright tag must contain a year and the name of the copyright holder
Loading history...
9
 */
0 ignored issues
show
PHP version not specified
Loading history...
Missing @category tag in file comment
Loading history...
Missing @package tag in file comment
Loading history...
Missing @author tag in file comment
Loading history...
Missing @license tag in file comment
Loading history...
10
11
namespace nystudio107\connect\models;
12
13
use craft\base\Model;
14
use craft\validators\ArrayValidator;
15
16
/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
17
 * @author    nystudio107
0 ignored issues
show
The tag in position 1 should be the @package tag
Loading history...
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
Tag value for @author tag indented incorrectly; expected 2 spaces but found 4
Loading history...
18
 * @package   Connect
0 ignored issues
show
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
19
 * @since     1.0.0
0 ignored issues
show
The tag in position 3 should be the @author tag
Loading history...
Tag value for @since tag indented incorrectly; expected 3 spaces but found 5
Loading history...
20
 */
0 ignored issues
show
Missing @category tag in class comment
Loading history...
Missing @license tag in class comment
Loading history...
Missing @link tag in class comment
Loading history...
21
class Settings extends Model
22
{
23
    // Public Properties
24
    // =========================================================================
25
26
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
27
     * @var array the database connections
28
     */
29
    public $connections = [];
30
31
    // Public Methods
32
    // =========================================================================
33
34
    public function init()
0 ignored issues
show
You must use "/**" style comments for a function comment
Loading history...
35
    {
36
        // Fill in some sane defaults if none are provided
37
        if (empty($this->connections)) {
38
            $this->connections = [
39
                'remote' => [
40
                    'driver' => getenv('REMOTE_DB_DRIVER'),
41
                    'server' => getenv('REMOTE_DB_SERVER'),
42
                    'user' => getenv('REMOTE_DB_USER'),
43
                    'password' => getenv('REMOTE_DB_PASSWORD'),
44
                    'database' => getenv('REMOTE_DB_DATABASE'),
45
                    'schema' => getenv('REMOTE_DB_SCHEMA'),
46
                    'tablePrefix' => getenv('REMOTE_DB_TABLE_PREFIX'),
47
                    'port' => getenv('REMOTE_DB_PORT')
48
                ],
49
            ];
50
        }
51
    }
52
53
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
54
     * @inheritdoc
55
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
56
    public function rules()
57
    {
58
        return [
59
            ['connections', ArrayValidator::class],
60
        ];
61
    }
62
}
63