| Conditions | 5 |
| Paths | 16 |
| Total Lines | 74 |
| Code Lines | 49 |
| 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 |
||
| 49 | public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) |
||
| 50 | { |
||
| 51 | if (version_compare($context->getVersion(), '1.3.0', '<')) {// pre update version is lower than 1.3.0 |
||
| 52 | $this->addTable($setup, \Payone\Core\Setup\Tables\CheckedAddresses::getData()); |
||
| 53 | |||
| 54 | $setup->getConnection('checkout')->addColumn( |
||
| 55 | $setup->getTable('quote_address'), |
||
| 56 | 'payone_addresscheck_score', |
||
| 57 | [ |
||
| 58 | 'type' => Table::TYPE_TEXT, |
||
| 59 | 'length' => 1, |
||
| 60 | 'nullable' => false, |
||
| 61 | 'default' => '', |
||
| 62 | 'comment' => 'AddressCheck Person Status Score (G, Y, R)' |
||
| 63 | ] |
||
| 64 | ); |
||
| 65 | $setup->getConnection('checkout')->addColumn( |
||
| 66 | $setup->getTable('quote_address'), |
||
| 67 | 'payone_protect_score', |
||
| 68 | [ |
||
| 69 | 'type' => Table::TYPE_TEXT, |
||
| 70 | 'length' => 1, |
||
| 71 | 'nullable' => false, |
||
| 72 | 'default' => '', |
||
| 73 | 'comment' => 'Consumerscore Status Score (G, Y, R)' |
||
| 74 | ] |
||
| 75 | ); |
||
| 76 | } |
||
| 77 | if (!$setup->getConnection()->isTableExists($setup->getTable(PaymentBan::TABLE_PAYMENT_BAN))) { |
||
| 78 | $this->addTable($setup, PaymentBan::getData()); |
||
| 79 | } |
||
| 80 | if (version_compare($context->getVersion(), '2.3.0', '<=')) { |
||
| 81 | $setup->getConnection()->modifyColumn( |
||
| 82 | $setup->getTable('payone_protocol_api'), |
||
| 83 | 'mid', ['type' => Table::TYPE_INTEGER, 'default' => '0'] |
||
| 84 | ); |
||
| 85 | $setup->getConnection()->modifyColumn( |
||
| 86 | $setup->getTable('payone_protocol_api'), |
||
| 87 | 'aid', ['type' => Table::TYPE_INTEGER, 'default' => '0'] |
||
| 88 | ); |
||
| 89 | $setup->getConnection()->modifyColumn( |
||
| 90 | $setup->getTable('payone_protocol_api'), |
||
| 91 | 'portalid', ['type' => Table::TYPE_INTEGER, 'default' => '0'] |
||
| 92 | ); |
||
| 93 | } |
||
| 94 | |||
| 95 | /* |
||
| 96 | * add index to payone_protocol_api::txid to speed up transaction status calls |
||
| 97 | */ |
||
| 98 | if (version_compare($context->getVersion(), '2.3.1', '<=')) { |
||
| 99 | |||
| 100 | $connection = $setup->getConnection(); |
||
| 101 | $protocolApiTable = $connection->getTableName(Api::TABLE_PROTOCOL_API); |
||
| 102 | $indexField = 'txid'; |
||
| 103 | |||
| 104 | $connection->addIndex( |
||
| 105 | $protocolApiTable, |
||
| 106 | $connection->getIndexName($protocolApiTable, $indexField), |
||
| 107 | $indexField |
||
| 108 | ); |
||
| 109 | |||
| 110 | $transactionStatusTable = $connection->getTableName(Transactionstatus::TABLE_PROTOCOL_TRANSACTIONSTATUS); |
||
| 111 | $indexFieldTxid = 'txid'; |
||
| 112 | $indexFieldCustomerid = 'customerid'; |
||
| 113 | |||
| 114 | $connection->addIndex( |
||
| 115 | $transactionStatusTable, |
||
| 116 | $connection->getIndexName($transactionStatusTable, $indexFieldTxid), |
||
| 117 | $indexFieldTxid |
||
| 118 | ); |
||
| 119 | $connection->addIndex( |
||
| 120 | $transactionStatusTable, |
||
| 121 | $connection->getIndexName($transactionStatusTable, $indexFieldCustomerid), |
||
| 122 | $indexFieldCustomerid |
||
| 123 | ); |
||
| 127 |
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