Issues (151)

src/Connect.php (25 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;
12
13
use nystudio107\connect\models\Settings;
14
use nystudio107\connect\variables\ConnectVariable;
15
16
use Craft;
17
use craft\base\Plugin;
18
use craft\web\twig\variables\CraftVariable;
19
20
use yii\base\Event;
21
22
/**
23
 * Class Connect
24
 *
25
 * @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...
26
 * @package   Connect
0 ignored issues
show
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
27
 * @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...
28
 */
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...
29
class Connect extends Plugin
30
{
31
    // Static Properties
32
    // =========================================================================
33
34
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
35
     * @var Connect
36
     */
37
    public static $plugin;
38
39
    // Public Properties
40
    // =========================================================================
41
42
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
43
     * @var string
44
     */
45
    public $schemaVersion = '1.0.0';
46
47
    // Public Methods
48
    // =========================================================================
49
50
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
51
     * @inheritdoc
52
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
53
    public function init()
54
    {
55
        parent::init();
56
        self::$plugin = $this;
57
58
        Event::on(
59
            CraftVariable::class,
60
            CraftVariable::EVENT_INIT,
61
            function (Event $event) {
62
                /** @var CraftVariable $variable */
0 ignored issues
show
The open comment tag must be the only content on the line
Loading history...
Missing short description in doc comment
Loading history...
The close comment tag must be the only content on the line
Loading history...
63
                $variable = $event->sender;
64
                $variable->set('connect', ConnectVariable::class);
65
            }
66
        );
67
68
        Craft::info(
69
            Craft::t(
70
                'connect',
71
                '{name} plugin loaded',
72
                ['name' => $this->name]
73
            ),
74
            __METHOD__
75
        );
76
    }
77
78
    // Protected Methods
79
    // =========================================================================
80
81
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
82
     * @inheritdoc
83
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
84
    protected function createSettingsModel()
85
    {
86
        return new Settings();
87
    }
88
}
89