Conditions | 10 |
Paths | 25 |
Total Lines | 94 |
Code Lines | 66 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
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 |
||
55 | public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) |
||
56 | { |
||
57 | $setup->startSetup(); |
||
58 | $prefixedTableName = $setup->getConnection()->getTableName(self::CONFIG_TABLE); |
||
59 | $prefixedOrdersTableName = $setup->getConnection()->getTableName(self::ORDERS_TABLE); |
||
60 | if ($setup->tableExists($prefixedTableName)) { |
||
61 | if (version_compare($context->getVersion(), '8.3.1') < 0) { |
||
62 | $newConfigs = array( |
||
63 | /* INSERT NEW CONFIGS PARAMS HERE:'config'=>'<value>'*/ |
||
64 | 'PAGANTIS_DISPLAY_MAX_AMOUNT' => 0 |
||
65 | ); |
||
66 | foreach ($newConfigs as $config => $value) { |
||
67 | $setup->getConnection() |
||
68 | ->insert($prefixedTableName, array('config' => $config, 'value' => $value)); |
||
69 | } |
||
70 | } |
||
71 | |||
72 | if (version_compare($context->getVersion(), '8.3.2') < 0) { |
||
73 | $newConfigs = array( |
||
74 | /* INSERT NEW CONFIGS PARAMS HERE:'config'=>'<value>'*/ |
||
75 | 'PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT' => 'sdk.simulator.types.CHECKOUT_PAGE' |
||
76 | ); |
||
77 | foreach ($newConfigs as $config => $value) { |
||
78 | $setup->getConnection() |
||
79 | ->insert($prefixedTableName, array('config' => $config, 'value' => $value)); |
||
80 | } |
||
81 | $setup->getConnection() |
||
82 | ->update( |
||
83 | $prefixedTableName, |
||
84 | array('value' => 'sdk.simulator.types.PRODUCT_PAGE'), |
||
85 | "config='PAGANTIS_SIMULATOR_DISPLAY_TYPE'" |
||
86 | ); |
||
87 | |||
88 | } |
||
89 | |||
90 | if (version_compare($context->getVersion(), '8.6.0') < 0) { |
||
91 | $newConfigs = array( |
||
92 | /* INSERT NEW CONFIGS PARAMS HERE:'config'=>'<value>'*/ |
||
93 | 'PAGANTIS_DISPLAY_MIN_AMOUNT_4x'=>0, |
||
94 | 'PAGANTIS_DISPLAY_MAX_AMOUNT_4x'=>800, |
||
95 | 'PAGANTIS_TITLE_4x'=>'Until 4 installments, without fees', |
||
96 | 'PAGANTIS_SIMULATOR_DISPLAY_SITUATION' => '' |
||
97 | ); |
||
98 | foreach ($newConfigs as $config => $value) { |
||
99 | $setup->getConnection() |
||
100 | ->insert($prefixedTableName, array('config' => $config, 'value' => $value)); |
||
101 | } |
||
102 | $setup->getConnection() |
||
103 | ->update( |
||
104 | $prefixedTableName, |
||
105 | array('value' => 'Instant financing'), |
||
106 | "config='PAGANTIS_TITLE'" |
||
107 | ); |
||
108 | } |
||
109 | |||
110 | if (version_compare($context->getVersion(), '8.6.1') < 0) { |
||
111 | if ($setup->tableExists($prefixedOrdersTableName)) { |
||
112 | $query = "ALTER TABLE $prefixedOrdersTableName ADD COLUMN token VARCHAR(32) NOT NULL AFTER order_id"; |
||
113 | $setup->getConnection()->query($query); |
||
114 | |||
115 | $query = "ALTER TABLE $prefixedOrdersTableName DROP PRIMARY KEY, ADD PRIMARY KEY(id, order_id)"; |
||
116 | $setup->getConnection()->query($query); |
||
117 | } |
||
118 | } |
||
119 | } |
||
120 | $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); |
||
121 | $eavSetup->addAttribute( |
||
122 | \Magento\Catalog\Model\Product::ENTITY, |
||
123 | $this->code, |
||
124 | [ |
||
125 | 'group' => $this->group, |
||
126 | 'type' => 'int', |
||
127 | 'backend' => '', |
||
128 | 'frontend' => '', |
||
129 | 'label' => $this->label, |
||
130 | 'input' => 'boolean', |
||
131 | 'class' => '', |
||
132 | 'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean', |
||
133 | 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, |
||
134 | 'visible' => true, |
||
135 | 'required' => false, |
||
136 | 'user_defined' => false, |
||
137 | 'default' => '0', |
||
138 | 'searchable' => false, |
||
139 | 'filterable' => false, |
||
140 | 'comparable' => false, |
||
141 | 'visible_on_front' => false, |
||
142 | 'used_in_product_listing' => false, |
||
143 | 'unique' => false, |
||
144 | 'apply_to' => '' |
||
145 | ] |
||
146 | ); |
||
147 | |||
148 | $setup->endSetup(); |
||
149 | } |
||
150 | } |
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