Code Duplication    Length = 11-11 lines in 2 locations

src/Observers/UrlRewriteObserver.php 2 locations

@@ 146-156 (lines=11) @@
143
        // try to load the entity ID for the product with the passed SKU
144
        if ($product = $this->loadProduct($sku = $this->getValue(ColumnKeys::SKU))) {
145
            $this->setLastEntityId($this->entityId = $product[MemberNames::ENTITY_ID]);
146
        } else {
147
            // prepare a log message
148
            $message = sprintf('Product with SKU "%s" can\'t be loaded to create URL rewrites', $sku);
149
            // query whether or not we're in debug mode
150
            if ($this->getSubject()->isDebugMode()) {
151
                $this->getSubject()->getSystemLogger()->warning($message);
152
                return $this->getRow();
153
            } else {
154
                throw new \Exception($message);
155
            }
156
        }
157
158
        // try to load the URL key
159
        if ($this->hasValue(ColumnKeys::URL_KEY)) {
@@ 161-171 (lines=11) @@
158
        // try to load the URL key
159
        if ($this->hasValue(ColumnKeys::URL_KEY)) {
160
            $this->urlKey = $this->getValue(ColumnKeys::URL_KEY);
161
        } else {
162
            // prepare a log message
163
            $message = sprintf('Can\'t find a value in column "url_key" for product with SKU "%s"', $sku);
164
            // query whether or not we're in debug mode
165
            if ($this->getSubject()->isDebugMode()) {
166
                $this->getSubject()->getSystemLogger()->warning($message);
167
                return $this->getRow();
168
            } else {
169
                throw new \Exception($message);
170
            }
171
        }
172
173
        // initialize the store view code
174
        $this->getSubject()->prepareStoreViewCode();