Test Setup Failed
Push — master ( d6fde7...1e848b )
by Php Easy Api
04:20
created

QueryBase::getColumns()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 16
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 7
c 1
b 0
f 0
nc 6
nop 1
dl 0
loc 16
rs 10
1
<?php
2
3
namespace Migratio\GrammarStructure\Mysql;
4
5
use Migratio\Contract\QueryBaseContract;
6
use Migratio\Contract\ColumnsProcessContract;
7
use Migratio\GrammarStructure\Mysql\Traits\QueryStack;
8
use Migratio\GrammarStructure\Mysql\Traits\ColumnsProcess;
9
10
class QueryBase implements QueryBaseContract
11
{
12
    use QueryStack,ColumnsProcess;
0 ignored issues
show
Bug introduced by
The trait Migratio\GrammarStructure\Mysql\Traits\QueryStack requires the property $schema which is not provided by Migratio\GrammarStructure\Mysql\QueryBase.
Loading history...
13
14
    /**
15
     * @return mixed
16
     */
17
    protected function connection()
18
    {
19
        return $this->getConnection();
0 ignored issues
show
introduced by
The method getConnection() does not exist on Migratio\GrammarStructure\Mysql\QueryBase. Maybe you want to declare this class abstract? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
        return $this->/** @scrutinizer ignore-call */ getConnection();
Loading history...
20
    }
21
22
    /**
23
     * @return array|mixed
24
     */
25
    public function getTables()
26
    {
27
        $tables = $this->showTables();
28
29
        $list = [];
30
31
        foreach ($tables as $key=>$resource){
32
33
            $list[$key] = $resource[0];
34
        }
35
36
        return $list;
37
    }
38
39
    /**
40
     * @param array $tables
41
     * @return ColumnsProcessContract
42
     */
43
    public function getColumns($tables=array())
44
    {
45
        $tableList = (count($tables)) ? $tables : $this->getTables();
46
47
        $list = [];
48
49
        foreach ($tableList as $table){
50
51
            if(in_array($table,$this->getTables())){
52
                $list[$table] = $this->showColumnsFrom($table);
53
            }
54
        }
55
56
        $this->columnsProcess($list);
57
58
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Migratio\GrammarStructure\Mysql\QueryBase which is incompatible with the documented return type Migratio\Contract\ColumnsProcessContract.
Loading history...
59
60
    }
61
62
    public function createTable()
63
    {
64
65
    }
66
}
67
68