Completed
Branch trunk (78000f)
by SuperNova.WS
25:55 queued 09:00
created

RecordActiveAbstractObject::dbGetTableFields()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 89
Code Lines 42

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 42
nc 1
nop 0
dl 0
loc 89
rs 8.5731
c 0
b 0
f 0

How to fix   Long Method   

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
 * Created by Gorlum 12.07.2017 12:34
4
 */
5
6
namespace DBAL\Tests\Fixtures;
7
8
9
use DBAL\ActiveRecordAbstract;
10
11
class RecordActiveAbstractObject extends ActiveRecordAbstract {
12
  protected static $_tableName = '';
13
  protected static $_fieldsToProperties = [
14
    'timestamp_current' => 'timestampCurrent',
15
  ];
16
17
  /**
18
   * @inheritdoc
19
   */
20
  protected static function dbGetTableFields() {
21
    return
22
      [
23
        'id'                =>
24
          [
25
            'Field'      => 'id',
26
            'Type'       => 'bigint(20) unsigned',
27
            'Collation'  => null,
28
            'Null'       => 'NO',
29
            'Key'        => 'PRI',
30
            'Default'    => null,
31
            'Extra'      => 'auto_increment',
32
            'Privileges' => 'select,insert,update,references',
33
            'Comment'    => '',
34
          ],
35
        'timestamp_current' =>
36
          [
37
            'Field'      => 'timestamp_current',
38
            'Type'       => 'timestamp',
39
            'Collation'  => null,
40
            'Null'       => 'NO',
41
            'Key'        => '',
42
            'Default'    => 'CURRENT_TIMESTAMP',
43
            'Extra'      => 'on update CURRENT_TIMESTAMP',
44
            'Privileges' => 'select,insert,update,references',
45
            'Comment'    => '',
46
          ],
47
        'varchar'           =>
48
          [
49
            'Field'      => 'varchar',
50
            'Type'       => 'varchar(32)',
51
            'Collation'  => 'utf8_general_ci',
52
            'Null'       => 'YES',
53
            'Key'        => 'UNI',
54
            'Default'    => '',
55
            'Extra'      => '',
56
            'Privileges' => 'select,insert,update,references',
57
            'Comment'    => '',
58
          ],
59
        'null'              =>
60
          [
61
            'Field'      => 'varchar',
62
            'Type'       => 'varchar(32)',
63
            'Collation'  => 'utf8_general_ci',
64
            'Null'       => 'YES',
65
            'Key'        => 'UNI',
66
            'Default'    => null,
67
            'Extra'      => '',
68
            'Privileges' => 'select,insert,update,references',
69
            'Comment'    => '',
70
          ],
71
//        'owner'             =>
72
//          [
73
//            'Field'      => 'ally_owner',
74
//            'Type'       => 'bigint(20) unsigned',
75
//            'Collation'  => null,
76
//            'Null'       => 'YES',
77
//            'Key'        => 'MUL',
78
//            'Default'    => null,
79
//            'Extra'      => '',
80
//            'Privileges' => 'select,insert,update,references',
81
//            'Comment'    => '',
82
//          ],
83
//        'unix_time'         =>
84
//          [
85
//            'Field'      => 'ally_register_time',
86
//            'Type'       => 'int(11)',
87
//            'Collation'  => null,
88
//            'Null'       => 'NO',
89
//            'Key'        => '',
90
//            'Default'    => '0',
91
//            'Extra'      => '',
92
//            'Privileges' => 'select,insert,update,references',
93
//            'Comment'    => '',
94
//          ],
95
//        'medium_text'       =>
96
//          [
97
//            'Field'      => 'ally_description',
98
//            'Type'       => 'mediumtext',
99
//            'Collation'  => 'utf8_general_ci',
100
//            'Null'       => 'YES',
101
//            'Key'        => '',
102
//            'Default'    => null,
103
//            'Extra'      => '',
104
//            'Privileges' => 'select,insert,update,references',
105
//            'Comment'    => '',
106
//          ],
107
      ];
108
  }
109
110
  /**
111
   * @return bool
112
   */
113
  protected function dbInsert() {
114
    // TODO: Implement dbInsert() method.
115
  }
116
117
  /**
118
   * Asks DB for last insert ID
119
   *
120
   * @return int|string
121
   */
122
  protected function dbLastInsertId() {
123
    // TODO: Implement dbLastInsertId() method.
124
  }
125
126
  /**
127
   * @return bool
128
   */
129
  protected function dbUpdate() {
130
    // TODO: Implement dbUpdate() method.
131
  }
132
133
}
134