Conditions | 9 |
Paths | 6 |
Total Lines | 57 |
Code Lines | 29 |
Lines | 6 |
Ratio | 10.53 % |
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 | // prepare the store view code |
||
58 | $this->prepareStoreViewCode(); |
||
59 | |||
60 | // initialize the array with the artefacts |
||
61 | $artefacts = array(); |
||
62 | |||
63 | // load the attribute option values for the custom store views |
||
64 | $attributeOptionValues = $this->getValue(ColumnKeys::ATTRIBUTE_OPTION_VALUES, array(), array($this, 'explode')); |
||
65 | $attributeOptionSwatch = $this->explode($this->getValue(ColumnKeys::ATTRIBUTE_OPTION_SWATCH), $this->getMultipleValueDelimiter()); |
||
|
|||
66 | |||
67 | // iterate over the attribute option values and export them |
||
68 | foreach ($attributeOptionValues as $key => $attributeOptionValue) { |
||
69 | // load the artefacts with the admin store values |
||
70 | $adminValueArtefacts = reset($this->getArtefactsByTypeAndEntityId(AttributeOptionExportObserver::ARTEFACT_TYPE, $this->getLastEntityId())); |
||
71 | |||
72 | // initialize the attribute option swatch data |
||
73 | $optionSwatch = array(); |
||
74 | if (isset($attributeOptionSwatch[$key])) { |
||
75 | // prepare the EAV attribute option swatch values |
||
76 | View Code Duplication | foreach ($this->explode($attributeOptionSwatch[$key]) as $value) { |
|
77 | $explodedSwatch = $this->explode($value, '='); |
||
78 | if (isset($explodedSwatch[0]) && isset($explodedSwatch[1])) { |
||
79 | $optionSwatch[$explodedSwatch[0]] = $explodedSwatch[1]; |
||
80 | } |
||
81 | } |
||
82 | |||
83 | // initialize and add the new artefact |
||
84 | $artefacts[] = $this->newArtefact( |
||
85 | array( |
||
86 | ColumnKeys::STORE_VIEW_CODE => $this->getValue(ColumnKeys::STORE_VIEW_CODE), |
||
87 | ColumnKeys::ATTRIBUTE_CODE => $this->getValue(ColumnKeys::ATTRIBUTE_CODE), |
||
88 | ColumnKeys::ADMIN_STORE_VALUE => $adminValueArtefacts[$key][ColumnKeys::VALUE], |
||
89 | ColumnKeys::SWATCH_TYPE => isset($optionSwatch[ColumnKeys::TYPE]) ? $optionSwatch[ColumnKeys::TYPE] : null, |
||
90 | ColumnKeys::SWATCH_VALUE => isset($optionSwatch[ColumnKeys::VALUE]) ? $optionSwatch[ColumnKeys::VALUE] : null |
||
91 | ), |
||
92 | array( |
||
93 | ColumnKeys::STORE_VIEW_CODE => ColumnKeys::STORE_VIEW_CODE, |
||
94 | ColumnKeys::ATTRIBUTE_CODE => ColumnKeys::ATTRIBUTE_CODE, |
||
95 | ColumnKeys::ADMIN_STORE_VALUE => $adminValueArtefacts[$key][ColumnKeys::VALUE], |
||
96 | ColumnKeys::SWATCH_TYPE => ColumnKeys::ATTRIBUTE_OPTION_SWATCH, |
||
97 | ColumnKeys::SWATCH_VALUE => ColumnKeys::ATTRIBUTE_OPTION_SWATCH |
||
98 | ) |
||
99 | ); |
||
100 | } |
||
101 | } |
||
102 | |||
103 | // add the array with the artefacts |
||
104 | $this->addArtefacts($artefacts); |
||
105 | } |
||
106 | |||
117 |
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.