Conditions | 1 |
Paths | 1 |
Total Lines | 56 |
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 |
||
47 | public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) |
||
48 | { |
||
49 | /** @var \Magento\Eav\Setup\EavSetup $eavSetup */ |
||
50 | $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); |
||
51 | |||
52 | $eavSetup->addAttribute( |
||
53 | ProductAttributeInterface::ENTITY_TYPE_CODE, |
||
54 | 'attachments_title', |
||
55 | [ |
||
56 | 'type' => 'varchar', |
||
57 | 'input' => 'text', |
||
58 | 'frontend_class' => 'validate-no-html-tags validate-length maximum-length-255', |
||
59 | 'label' => 'Attachments title', |
||
60 | |||
61 | 'group' => 'product-details', |
||
62 | 'sort_order' => 115, |
||
63 | |||
64 | |||
65 | 'backend' => '', |
||
66 | 'frontend' => '', |
||
67 | 'source' => '', |
||
68 | |||
69 | 'default' => null, |
||
70 | |||
71 | 'wysiwyg_enabled' => false, |
||
72 | 'is_html_allowed_on_front' => false, |
||
73 | |||
74 | 'used_for_sort_by' => false, |
||
75 | |||
76 | 'global' => ScopedAttributeInterface::SCOPE_STORE, |
||
77 | 'visible' => false, |
||
78 | 'required' => false, |
||
79 | 'user_defined' => false, |
||
80 | |||
81 | 'searchable' => false, |
||
82 | 'visible_in_advanced_search' => false, |
||
83 | 'search_weight' => '', |
||
84 | 'filterable' => false, |
||
85 | 'filterable_in_search' => false, |
||
86 | 'comparable' => false, |
||
87 | 'visible_on_front' => false, |
||
88 | 'used_in_product_listing' => false, |
||
89 | 'unique' => false, |
||
90 | 'apply_to' => '', |
||
91 | 'used_for_promo_rules' => false, |
||
92 | |||
93 | 'is_used_in_grid' => false, |
||
94 | 'is_visible_in_grid' => false, |
||
95 | 'is_filterable_in_grid' => false, |
||
96 | |||
97 | 'is_required_in_admin_store' => '', |
||
98 | |||
99 | 'system' => 0 |
||
100 | ] |
||
101 | ); |
||
102 | } |
||
103 | } |
||
104 |