Conditions | 10 |
Paths | 4 |
Total Lines | 51 |
Code Lines | 28 |
Lines | 6 |
Ratio | 11.76 % |
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 | protected function process() |
||
50 | { |
||
51 | |||
52 | // do NOT export the value if we're NOT in the admin store view |
||
53 | if (!$this->isAdminStore()) { |
||
54 | return; |
||
55 | } |
||
56 | |||
57 | // initialize the array with the artefacts |
||
58 | $artefacts = array(); |
||
59 | |||
60 | // load the attribute option values/positions |
||
61 | $attributeOptionValues = $this->getValue(ColumnKeys::ATTRIBUTE_OPTION_VALUES, array(), array($this, 'explode')); |
||
62 | $attributeOptionSortOrder = $this->getValue(ColumnKeys::ATTRIBUTE_OPTION_SORT_ORDER, array(), array($this, 'explode')); |
||
63 | $attributeOptionSwatch = $this->explode($this->getValue(ColumnKeys::ATTRIBUTE_OPTION_SWATCH), $this->getMultipleValueDelimiter()); |
||
|
|||
64 | |||
65 | // iterate over the attribute option values and export them |
||
66 | foreach ($attributeOptionValues as $key => $attributeOptionValue) { |
||
67 | // initialize the attribute option swatch data |
||
68 | $optionSwatch = array(); |
||
69 | if (isset($attributeOptionSwatch[$key])) { |
||
70 | View Code Duplication | foreach ($this->explode($attributeOptionSwatch[$key]) as $value) { |
|
71 | $explodedSwatch = $this->explode($value, '='); |
||
72 | if (isset($explodedSwatch[0]) && isset($explodedSwatch[1])) { |
||
73 | $optionSwatch[$explodedSwatch[0]] = $explodedSwatch[1]; |
||
74 | } |
||
75 | } |
||
76 | } |
||
77 | |||
78 | // initialize and add the new artefact |
||
79 | $artefacts[] = $this->newArtefact( |
||
80 | array( |
||
81 | ColumnKeys::ATTRIBUTE_CODE => $this->getValue(ColumnKeys::ATTRIBUTE_CODE), |
||
82 | ColumnKeys::VALUE => $attributeOptionValue, |
||
83 | ColumnKeys::SORT_ORDER => isset($attributeOptionSortOrder[$key]) ? $attributeOptionSortOrder[$key] : 0, |
||
84 | ColumnKeys::SWATCH_TYPE => isset($optionSwatch[ColumnKeys::TYPE]) ? $optionSwatch[ColumnKeys::TYPE] : null, |
||
85 | ColumnKeys::SWATCH_VALUE => isset($optionSwatch[ColumnKeys::VALUE]) ? $optionSwatch[ColumnKeys::VALUE] : null |
||
86 | ), |
||
87 | array( |
||
88 | ColumnKeys::ATTRIBUTE_CODE => ColumnKeys::ATTRIBUTE_CODE, |
||
89 | ColumnKeys::VALUE => ColumnKeys::VALUE, |
||
90 | ColumnKeys::SORT_ORDER => ColumnKeys::ATTRIBUTE_OPTION_SORT_ORDER, |
||
91 | ColumnKeys::SWATCH_TYPE => ColumnKeys::ATTRIBUTE_OPTION_SWATCH, |
||
92 | ColumnKeys::SWATCH_VALUE => ColumnKeys::ATTRIBUTE_OPTION_SWATCH |
||
93 | ) |
||
94 | ); |
||
95 | } |
||
96 | |||
97 | // add the array with the artefacts |
||
98 | $this->addArtefacts($artefacts); |
||
99 | } |
||
100 | |||
111 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.