| Conditions | 1 |
| Paths | 1 |
| Total Lines | 69 |
| Code Lines | 58 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 21 | public function define(Schema $schema): void |
||
| 22 | { |
||
| 23 | // Messenger definition |
||
| 24 | $messengerTable = $schema->createTable('messenger_messages'); |
||
| 25 | $messengerTable->addColumn('id', 'bigint', ['autoincrement' => true]); |
||
| 26 | $messengerTable->addColumn('body', 'text'); |
||
| 27 | $messengerTable->addColumn('headers', 'text'); |
||
| 28 | $messengerTable->addColumn('queue_name', 'string', ['length' => 190]); |
||
| 29 | $messengerTable->addColumn('created_at', 'datetime'); |
||
| 30 | $messengerTable->addColumn('available_at', 'datetime'); |
||
| 31 | $messengerTable->addColumn('delivered_at', 'datetime', ['notnull' => false]); |
||
| 32 | $messengerTable->addIndex(['queue_name']); |
||
| 33 | $messengerTable->addIndex(['available_at']); |
||
| 34 | $messengerTable->addIndex(['delivered_at']); |
||
| 35 | $messengerTable->setPrimaryKey(['id']); |
||
| 36 | |||
| 37 | // Company definition |
||
| 38 | $companyTable = $schema->createTable('company'); |
||
| 39 | $companyTable->addColumn('uuid', 'string', ['length' => 36]); |
||
| 40 | $companyTable->addColumn('name', 'string', ['length' => 150]); |
||
| 41 | $companyTable->addColumn('address', 'string'); |
||
| 42 | $companyTable->addColumn('zip_code', 'string', ['length' => 5]); |
||
| 43 | $companyTable->addColumn('town', 'string'); |
||
| 44 | $companyTable->addColumn('country', 'string'); |
||
| 45 | $companyTable->addColumn('phone', 'string', ['length' => 12]); |
||
| 46 | $companyTable->addColumn('facsimile', 'string', ['notnull' => false, 'length' => 12]); |
||
| 47 | $companyTable->addColumn('email', 'string'); |
||
| 48 | $companyTable->addColumn('contact_name', 'string'); |
||
| 49 | $companyTable->addColumn('cellphone', 'string', ['length' => 12]); |
||
| 50 | $companyTable->addColumn('slug', 'string'); |
||
| 51 | $companyTable->setPrimaryKey(['uuid']); |
||
| 52 | |||
| 53 | // Settings definition |
||
| 54 | $settingsTable = $schema->createTable('settings'); |
||
| 55 | $settingsTable->addColumn('uuid', 'string', ['length' => 36]); |
||
| 56 | $settingsTable->addColumn('currency', 'string', ['length' => 20]); |
||
| 57 | $settingsTable->addColumn('locale', 'string', ['length' => 10]); |
||
| 58 | $settingsTable->setPrimaryKey(['uuid']); |
||
| 59 | |||
| 60 | // User definition |
||
| 61 | $userTable = $schema->createTable('user'); |
||
| 62 | $userTable->addColumn('uuid', 'string', ['length' => 36]); |
||
| 63 | $userTable->addColumn('username', 'string', ['length' => 150]); |
||
| 64 | $userTable->addColumn('email', 'string'); |
||
| 65 | $userTable->addColumn('password', 'string', ['length' => 120]); |
||
| 66 | $userTable->addColumn('roles', 'simple_array'); |
||
| 67 | $userTable->setPrimaryKey(['uuid']); |
||
| 68 | |||
| 69 | // Supplier definition |
||
| 70 | $supplierTable = $schema->createTable('supplier'); |
||
| 71 | $supplierTable->addColumn('uuid', 'string', ['length' => 36]); |
||
| 72 | $supplierTable->addColumn('name', 'string', ['length' => 150]); |
||
| 73 | $supplierTable->addColumn('address', 'string'); |
||
| 74 | $supplierTable->addColumn('zip_code', 'string', ['length' => 5]); |
||
| 75 | $supplierTable->addColumn('town', 'string'); |
||
| 76 | $supplierTable->addColumn('country', 'string'); |
||
| 77 | $supplierTable->addColumn('phone', 'string', ['length' => 12]); |
||
| 78 | $supplierTable->addColumn('facsimile', 'string', ['notnull' => false, 'length' => 12]); |
||
| 79 | $supplierTable->addColumn('email', 'string'); |
||
| 80 | $supplierTable->addColumn('contact_name', 'string'); |
||
| 81 | $supplierTable->addColumn('cellphone', 'string', ['length' => 12]); |
||
| 82 | $supplierTable->addColumn('family_log', 'string'); |
||
| 83 | $supplierTable->addColumn('delay_delivery', 'integer'); |
||
| 84 | $supplierTable->addColumn('order_days', 'simple_array'); |
||
| 85 | $supplierTable->addColumn('slug', 'string'); |
||
| 86 | $supplierTable->addColumn('active', 'smallint', ['length' => 1]); |
||
| 87 | $supplierTable->setPrimaryKey(['uuid']); |
||
| 88 | $supplierTable->addUniqueIndex(['name']); |
||
| 89 | $supplierTable->addUniqueIndex(['slug']); |
||
| 90 | } |
||
| 92 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths