Conditions | 1 |
Paths | 1 |
Total Lines | 87 |
Code Lines | 63 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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:
If many parameters/temporary variables are present:
1 | <?php |
||
16 | public static function getAuditTableColumns(): array |
||
17 | { |
||
18 | return [ |
||
19 | 'id' => [ |
||
20 | 'type' => DoctrineHelper::getDoctrineType('INTEGER'), |
||
21 | 'options' => [ |
||
22 | 'autoincrement' => true, |
||
23 | 'unsigned' => true, |
||
24 | ], |
||
25 | ], |
||
26 | 'type' => [ |
||
27 | 'type' => DoctrineHelper::getDoctrineType('STRING'), |
||
28 | 'options' => [ |
||
29 | 'notnull' => true, |
||
30 | 'length' => 10, |
||
31 | ], |
||
32 | ], |
||
33 | 'object_id' => [ |
||
34 | 'type' => DoctrineHelper::getDoctrineType('STRING'), |
||
35 | 'options' => [ |
||
36 | 'notnull' => true, |
||
37 | ], |
||
38 | ], |
||
39 | 'discriminator' => [ |
||
40 | 'type' => DoctrineHelper::getDoctrineType('STRING'), |
||
41 | 'options' => [ |
||
42 | 'default' => null, |
||
43 | 'notnull' => false, |
||
44 | ], |
||
45 | ], |
||
46 | 'transaction_hash' => [ |
||
47 | 'type' => DoctrineHelper::getDoctrineType('STRING'), |
||
48 | 'options' => [ |
||
49 | 'notnull' => false, |
||
50 | 'length' => 40, |
||
51 | ], |
||
52 | ], |
||
53 | 'diffs' => [ |
||
54 | 'type' => DoctrineHelper::getDoctrineType('JSON'), |
||
55 | 'options' => [ |
||
56 | 'default' => null, |
||
57 | 'notnull' => false, |
||
58 | ], |
||
59 | ], |
||
60 | 'blame_id' => [ |
||
61 | 'type' => DoctrineHelper::getDoctrineType('STRING'), |
||
62 | 'options' => [ |
||
63 | 'default' => null, |
||
64 | 'notnull' => false, |
||
65 | ], |
||
66 | ], |
||
67 | 'blame_user' => [ |
||
68 | 'type' => DoctrineHelper::getDoctrineType('STRING'), |
||
69 | 'options' => [ |
||
70 | 'default' => null, |
||
71 | 'notnull' => false, |
||
72 | 'length' => 255, |
||
73 | ], |
||
74 | ], |
||
75 | 'blame_user_fqdn' => [ |
||
76 | 'type' => DoctrineHelper::getDoctrineType('STRING'), |
||
77 | 'options' => [ |
||
78 | 'default' => null, |
||
79 | 'notnull' => false, |
||
80 | 'length' => 255, |
||
81 | ], |
||
82 | ], |
||
83 | 'blame_user_firewall' => [ |
||
84 | 'type' => DoctrineHelper::getDoctrineType('STRING'), |
||
85 | 'options' => [ |
||
86 | 'default' => null, |
||
87 | 'notnull' => false, |
||
88 | 'length' => 100, |
||
89 | ], |
||
90 | ], |
||
91 | 'ip' => [ |
||
92 | 'type' => DoctrineHelper::getDoctrineType('STRING'), |
||
93 | 'options' => [ |
||
94 | 'default' => null, |
||
95 | 'notnull' => false, |
||
96 | 'length' => 45, |
||
97 | ], |
||
98 | ], |
||
99 | 'created_at' => [ |
||
100 | 'type' => DoctrineHelper::getDoctrineType('DATETIME_IMMUTABLE'), |
||
101 | 'options' => [ |
||
102 | 'notnull' => true, |
||
103 | ], |
||
148 |