| Conditions | 2 |
| Paths | 2 |
| Total Lines | 53 |
| Code Lines | 43 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 23 | public function change(): void |
||
| 24 | { |
||
| 25 | $table_name = \ByTIC\Payments\Utility\PaymentsModels::subscriptions()->getTable(); |
||
| 26 | $exists = $this->hasTable($table_name); |
||
| 27 | if ($exists) { |
||
| 28 | return; |
||
| 29 | } |
||
| 30 | |||
| 31 | $table = $this->table($table_name) |
||
| 32 | ->addColumn('id_method', 'biginteger') |
||
| 33 | ->addColumn('id_token', 'biginteger') |
||
| 34 | ->addColumn('id_last_transaction', 'biginteger') |
||
| 35 | ->addColumn('customer_id', 'biginteger') |
||
| 36 | ->addColumn('customer_type', 'string') |
||
| 37 | ->addColumn('status', 'enum', ['values' => ['not_started', 'active', 'completed', 'canceled']]) |
||
| 38 | ->addColumn('billing_period', 'enum', ['values' => ['daily', 'weekly', 'monthly', 'yearly']]) |
||
| 39 | ->addColumn('billing_interval', 'integer', ['limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]) |
||
| 40 | ->addColumn( |
||
| 41 | 'billing_count', |
||
| 42 | 'integer', |
||
| 43 | ['null' => true, 'limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY] |
||
| 44 | ) |
||
| 45 | ->addColumn('start_at', 'date', ['null' => true]) |
||
| 46 | ->addColumn('cancel_at', 'date', ['null' => true]) |
||
| 47 | ->addColumn('ended_at', 'date', ['null' => true]) |
||
| 48 | ->addColumn('charge_at', 'date', ['null' => true]) |
||
| 49 | ->addColumn('charge_attempts', 'integer', ['limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]) |
||
| 50 | ->addColumn( |
||
| 51 | 'charge_count', |
||
| 52 | 'integer', |
||
| 53 | ['null' => true, 'limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY] |
||
| 54 | ) |
||
| 55 | ->addColumn('charge_method', 'string') |
||
| 56 | ->addColumn('metadata', 'json', ['null' => true]) |
||
| 57 | ->addColumn('modified', 'timestamp', [ |
||
| 58 | 'default' => 'CURRENT_TIMESTAMP', |
||
| 59 | 'update' => 'CURRENT_TIMESTAMP', |
||
| 60 | ]) |
||
| 61 | ->addColumn('created', 'timestamp', [ |
||
| 62 | 'default' => 'CURRENT_TIMESTAMP', |
||
| 63 | ]); |
||
| 64 | |||
| 65 | $table->addIndex(['id_method']); |
||
| 66 | $table->addIndex(['id_token']); |
||
| 67 | $table->addIndex(['id_last_transaction']); |
||
| 68 | $table->addIndex(['customer_id', 'customer_type']); |
||
| 69 | $table->addIndex(['status']); |
||
| 70 | $table->addIndex(['start_at']); |
||
| 71 | $table->addIndex(['cancel_at']); |
||
| 72 | $table->addIndex(['ended_at']); |
||
| 73 | $table->addIndex(['charge_at']); |
||
| 74 | |||
| 75 | $table->save(); |
||
| 76 | } |
||
| 78 |
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