Code Duplication    Length = 11-11 lines in 2 locations

src/Observers/UrlRewriteObserver.php 2 locations

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