Issues (151)

src/db/Query.php (64 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\db;
12
13
use yii\db\Connection;
14
15
/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
16
 * @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...
17
 * @package   Connect
0 ignored issues
show
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
18
 * @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...
19
 */
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...
20
class Query extends \yii\db\Query
21
{
22
    // Public Properties
23
    // =========================================================================
24
25
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
26
     * @var Connection the database connections
27
     */
28
    public $db = null;
29
30
    // Public Methods
31
    // =========================================================================
32
33
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $db should have a doc-comment as per coding-style.
Loading history...
34
     * @inheritdoc
35
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
36
    public function createCommand($db = null)
37
    {
38
        return parent::createCommand($db ?? $this->db);
39
    }
40
    
41
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $batchSize should have a doc-comment as per coding-style.
Loading history...
Parameter $db should have a doc-comment as per coding-style.
Loading history...
42
     * @inheritdoc
43
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
44
    public function batch($batchSize = 100, $db = null)
45
    {
46
        return parent::batch($batchSize, $db ?? $this->db);
47
    }
48
49
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $batchSize should have a doc-comment as per coding-style.
Loading history...
Parameter $db should have a doc-comment as per coding-style.
Loading history...
50
     * @inheritdoc
51
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
52
    public function each($batchSize = 100, $db = null)
53
    {
54
        return parent::each($batchSize, $db ?? $this->db);
55
    }
56
57
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $db should have a doc-comment as per coding-style.
Loading history...
58
     * @inheritdoc
59
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
60
    public function all($db = null)
61
    {
62
        return parent::all($db ?? $this->db);
63
    }
64
65
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $db should have a doc-comment as per coding-style.
Loading history...
66
     * @inheritdoc
67
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
68
    public function one($db = null)
69
    {
70
        return parent::one($db ?? $this->db);
71
    }
72
73
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $db should have a doc-comment as per coding-style.
Loading history...
74
     * @inheritdoc
75
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
76
    public function scalar($db = null)
77
    {
78
        return parent::scalar($db ?? $this->db);
79
    }
80
81
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $db should have a doc-comment as per coding-style.
Loading history...
82
     * @inheritdoc
83
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
84
    public function column($db = null)
85
    {
86
        return parent::column($db ?? $this->db);
87
    }
88
89
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $q should have a doc-comment as per coding-style.
Loading history...
Parameter $db should have a doc-comment as per coding-style.
Loading history...
90
     * @inheritdoc
91
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
92
    public function count($q = '*', $db = null)
93
    {
94
        return parent::count($q, $db ?? $this->db);
95
    }
96
97
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $q should have a doc-comment as per coding-style.
Loading history...
Parameter $db should have a doc-comment as per coding-style.
Loading history...
98
     * @inheritdoc
99
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
100
    public function sum($q, $db = null)
101
    {
102
        return parent::sum($q, $db ?? $this->db);
103
    }
104
105
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $q should have a doc-comment as per coding-style.
Loading history...
Parameter $db should have a doc-comment as per coding-style.
Loading history...
106
     * @inheritdoc
107
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
108
    public function average($q, $db = null)
109
    {
110
        return parent::average($q, $db ?? $this->db);
111
    }
112
113
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $q should have a doc-comment as per coding-style.
Loading history...
Parameter $db should have a doc-comment as per coding-style.
Loading history...
114
     * @inheritdoc
115
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
116
    public function min($q, $db = null)
117
    {
118
        return parent::min($q, $db ?? $this->db);
119
    }
120
121
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $q should have a doc-comment as per coding-style.
Loading history...
Parameter $db should have a doc-comment as per coding-style.
Loading history...
122
     * @inheritdoc
123
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
124
    public function max($q, $db = null)
125
    {
126
        return parent::max($q, $db ?? $this->db);
127
    }
128
129
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $db should have a doc-comment as per coding-style.
Loading history...
130
     * @inheritdoc
131
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
132
    public function exists($db = null)
133
    {
134
        return parent::exists($db ?? $this->db);
135
    }
136
}
137