Conditions | 9 |
Paths | 102 |
Total Lines | 55 |
Code Lines | 39 |
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 |
||
77 | private function addCoreIndexes(OutputInterface $output) { |
||
78 | |||
79 | $output->writeln('<info>Check indices of the share table.</info>'); |
||
80 | |||
81 | $schema = new SchemaWrapper($this->connection); |
||
82 | $updated = false; |
||
83 | |||
84 | if ($schema->hasTable('share')) { |
||
85 | $table = $schema->getTable('share'); |
||
86 | if (!$table->hasIndex('share_with_index')) { |
||
87 | $output->writeln('<info>Adding additional share_with index to the share table, this can take some time...</info>'); |
||
88 | $table->addIndex(['share_with'], 'share_with_index'); |
||
89 | $this->connection->migrateToSchema($schema->getWrappedSchema()); |
||
90 | $updated = true; |
||
91 | $output->writeln('<info>Share table updated successfully.</info>'); |
||
92 | } |
||
93 | |||
94 | if (!$table->hasIndex('parent_index')) { |
||
95 | $output->writeln('<info>Adding additional parent index to the share table, this can take some time...</info>'); |
||
96 | $table->addIndex(['parent'], 'parent_index'); |
||
97 | $this->connection->migrateToSchema($schema->getWrappedSchema()); |
||
98 | $updated = true; |
||
99 | $output->writeln('<info>Share table updated successfully.</info>'); |
||
100 | } |
||
101 | |||
102 | if (!$table->hasIndex('owner_index')) { |
||
103 | $output->writeln('<info>Adding additional owner index to the share table, this can take some time...</info>'); |
||
104 | $table->addIndex(['uid_owner'], 'owner_index'); |
||
105 | $this->connection->migrateToSchema($schema->getWrappedSchema()); |
||
106 | $updated = true; |
||
107 | $output->writeln('<info>Share table updated successfully.</info>'); |
||
108 | } |
||
109 | |||
110 | if (!$table->hasIndex('initiator_index')) { |
||
111 | $output->writeln('<info>Adding additional initiator index to the share table, this can take some time...</info>'); |
||
112 | $table->addIndex(['uid_initiator'], 'initiator_index'); |
||
113 | $this->connection->migrateToSchema($schema->getWrappedSchema()); |
||
114 | $updated = true; |
||
115 | $output->writeln('<info>Share table updated successfully.</info>'); |
||
116 | } |
||
117 | } |
||
118 | |||
119 | $output->writeln('<info>Check indices of the filecache table.</info>'); |
||
120 | if ($schema->hasTable('filecache')) { |
||
121 | $table = $schema->getTable('filecache'); |
||
122 | if (!$table->hasIndex('fs_mtime')) { |
||
123 | $output->writeln('<info>Adding additional mtime index to the filecache table, this can take some time...</info>'); |
||
124 | $table->addIndex(['mtime'], 'fs_mtime'); |
||
125 | $this->connection->migrateToSchema($schema->getWrappedSchema()); |
||
126 | $updated = true; |
||
127 | $output->writeln('<info>Filecache table updated successfully.</info>'); |
||
128 | } |
||
129 | } |
||
130 | |||
131 | $output->writeln('<info>Check indices of the twofactor_providers table.</info>'); |
||
132 | if ($schema->hasTable('twofactor_providers')) { |
||
148 |