Code Duplication    Length = 24-24 lines in 3 locations

src/Observers/ProductMediaObserver.php 3 locations

@@ 70-93 (lines=24) @@
67
        $parentSku = $this->getValue(ColumnKeys::SKU);
68
69
        // query whether or not, we've a base image
70
        if ($baseImage = $this->getValue(ColumnKeys::BASE_IMAGE)) {
71
            // prepare the new base image
72
            $artefact = $this->newArtefact(
73
                array(
74
                    ColumnKeys::STORE_VIEW_CODE  => $storeViewCode,
75
                    ColumnKeys::IMAGE_PARENT_SKU => $parentSku,
76
                    ColumnKeys::IMAGE_PATH       => $baseImage,
77
                    ColumnKeys::IMAGE_PATH_NEW   => $baseImage,
78
                    ColumnKeys::IMAGE_LABEL      => $this->hasValue(ColumnKeys::BASE_IMAGE_LABEL) ?
79
                                                    $this->getValue(ColumnKeys::BASE_IMAGE_LABEL) :
80
                                                    $this->getDefaultImageLabel()
81
                ),
82
                array(
83
                    ColumnKeys::STORE_VIEW_CODE  => ColumnKeys::STORE_VIEW_CODE,
84
                    ColumnKeys::IMAGE_PARENT_SKU => ColumnKeys::SKU,
85
                    ColumnKeys::IMAGE_PATH       => ColumnKeys::BASE_IMAGE,
86
                    ColumnKeys::IMAGE_PATH_NEW   => ColumnKeys::BASE_IMAGE,
87
                    ColumnKeys::IMAGE_LABEL      => ColumnKeys::BASE_IMAGE_LABEL
88
                )
89
            );
90
91
            // append the base image to the artefacts
92
            $artefacts[] = $artefact;
93
        }
94
95
        // query whether or not, we've a small image
96
        if ($smallImage = $this->getValue(ColumnKeys::SMALL_IMAGE)) {
@@ 96-119 (lines=24) @@
93
        }
94
95
        // query whether or not, we've a small image
96
        if ($smallImage = $this->getValue(ColumnKeys::SMALL_IMAGE)) {
97
            // prepare the small image
98
            $artefact = $this->newArtefact(
99
                array(
100
                    ColumnKeys::STORE_VIEW_CODE  => $storeViewCode,
101
                    ColumnKeys::IMAGE_PARENT_SKU => $parentSku,
102
                    ColumnKeys::IMAGE_PATH       => $smallImage,
103
                    ColumnKeys::IMAGE_PATH_NEW   => $smallImage,
104
                    ColumnKeys::IMAGE_LABEL      => $this->hasValue(ColumnKeys::SMALL_IMAGE_LABEL) ?
105
                    $this->getValue(ColumnKeys::SMALL_IMAGE_LABEL) :
106
                    $this->getDefaultImageLabel()
107
                ),
108
                array(
109
                    ColumnKeys::STORE_VIEW_CODE  => ColumnKeys::STORE_VIEW_CODE,
110
                    ColumnKeys::IMAGE_PARENT_SKU => ColumnKeys::SKU,
111
                    ColumnKeys::IMAGE_PATH       => ColumnKeys::SMALL_IMAGE,
112
                    ColumnKeys::IMAGE_PATH_NEW   => ColumnKeys::SMALL_IMAGE,
113
                    ColumnKeys::IMAGE_LABEL      => ColumnKeys::SMALL_IMAGE_LABEL
114
                )
115
            );
116
117
            // append the small image to the artefacts
118
            $artefacts[] = $artefact;
119
        }
120
121
        // query whether or not, we've a small thumbnail
122
        if ($thumbnailImage = $this->getValue(ColumnKeys::THUMBNAIL_IMAGE)) {
@@ 122-145 (lines=24) @@
119
        }
120
121
        // query whether or not, we've a small thumbnail
122
        if ($thumbnailImage = $this->getValue(ColumnKeys::THUMBNAIL_IMAGE)) {
123
            // prepare the thumbnail image
124
            $artefact = $this->newArtefact(
125
                array(
126
                    ColumnKeys::STORE_VIEW_CODE  => $storeViewCode,
127
                    ColumnKeys::IMAGE_PARENT_SKU => $parentSku,
128
                    ColumnKeys::IMAGE_PATH       => $thumbnailImage,
129
                    ColumnKeys::IMAGE_PATH_NEW   => $thumbnailImage,
130
                    ColumnKeys::IMAGE_LABEL      => $this->hasValue(ColumnKeys::THUMBNAIL_IMAGE_LABEL) ?
131
                                                    $this->getValue(ColumnKeys::THUMBNAIL_IMAGE_LABEL) :
132
                                                    $this->getDefaultImageLabel()
133
                ),
134
                array(
135
                    ColumnKeys::STORE_VIEW_CODE  => ColumnKeys::STORE_VIEW_CODE,
136
                    ColumnKeys::IMAGE_PARENT_SKU => ColumnKeys::SKU,
137
                    ColumnKeys::IMAGE_PATH       => ColumnKeys::THUMBNAIL_IMAGE,
138
                    ColumnKeys::IMAGE_PATH_NEW   => ColumnKeys::THUMBNAIL_IMAGE,
139
                    ColumnKeys::IMAGE_LABEL      => ColumnKeys::THUMBNAIL_IMAGE_LABEL
140
                )
141
            );
142
143
            // append the thumbnail image to the artefacts
144
            $artefacts[] = $artefact;
145
        }
146
147
        // query whether or not, we've additional images
148
        if ($additionalImages = $this->getValue(ColumnKeys::ADDITIONAL_IMAGES, null, array($this, 'explode'))) {