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