Passed
Pull Request — master (#19761)
by
unknown
12:56 queued 03:52
created

Query::column()   C

Complexity

Conditions 12
Paths 29

Size

Total Lines 38
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 22
CRAP Score 12

Importance

Changes 0
Metric Value
cc 12
eloc 24
nc 29
nop 1
dl 0
loc 38
ccs 22
cts 22
cp 1
crap 12
rs 6.9666
c 0
b 0
f 0

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * @link https://www.yiiframework.com/
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5
 * @license https://www.yiiframework.com/license/
6
 */
7
8
namespace yii\db;
9
10
/**
11
 * Query represents a SELECT SQL statement in a way that is independent of DBMS.
12
 *
13
 * Query provides a set of methods to facilitate the specification of different clauses
14
 * in a SELECT statement. These methods can be chained together.
15
 *
16
 * By calling [[createCommand()]], we can get a [[Command]] instance which can be further
17
 * used to perform/execute the DB query against a database.
18
 *
19
 * For example,
20
 *
21
 * ```php
22
 * $query = new Query;
23
 * // compose the query
24
 * $query->select('id, name')
25
 *     ->from('user')
26
 *     ->limit(10);
27
 * // build and execute the query
28
 * $rows = $query->all();
29
 * // alternatively, you can create DB command and execute it
30
 * $command = $query->createCommand();
31
 * // $command->sql returns the actual SQL
32
 * $rows = $command->queryAll();
33
 * ```
34
 *
35
 * Query internally uses the [[QueryBuilder]] class to generate the SQL statement.
36
 *
37
 * A more detailed usage guide on how to work with Query can be found in the [guide article on Query Builder](guide:db-query-builder).
38
 *
39
 * @property-read string[] $tablesUsedInFrom Table names indexed by aliases.
40
 *
41
 * @author Qiang Xue <[email protected]>
42
 * @since 2.0
43
 */
44
class Query extends BaseQuery
45
{
46
}
47