Code Duplication    Length = 11-11 lines in 2 locations

src/Observers/UrlRewriteObserver.php 2 locations

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