Code Duplication    Length = 18-18 lines in 5 locations

src/Subjects/AbstractProductSubject.php 4 locations

@@ 367-384 (lines=18) @@
364
     * @return integer The tax class ID
365
     * @throws \Exception Is thrown, if the tax class with the requested name is not available
366
     */
367
    public function getTaxClassIdByTaxClassName($taxClassName)
368
    {
369
370
        // query whether or not, the requested tax class is available
371
        if (isset($this->taxClasses[$taxClassName])) {
372
            return (integer) $this->taxClasses[$taxClassName][MemberNames::CLASS_ID];
373
        }
374
375
        // throw an exception, if not
376
        throw new \Exception(
377
            sprintf(
378
                'Found invalid tax class name %s in file %s on line %d',
379
                $taxClassName,
380
                $this->getFilename(),
381
                $this->getLineNumber()
382
            )
383
        );
384
    }
385
386
    /**
387
     * Return's the store website for the passed code.
@@ 394-411 (lines=18) @@
391
     * @return integer The store website ID
392
     * @throws \Exception Is thrown, if the store website with the requested code is not available
393
     */
394
    public function getStoreWebsiteIdByCode($code)
395
    {
396
397
        // query whether or not, the requested store website is available
398
        if (isset($this->storeWebsites[$code])) {
399
            return (integer) $this->storeWebsites[$code][MemberNames::WEBSITE_ID];
400
        }
401
402
        // throw an exception, if not
403
        throw new \Exception(
404
            sprintf(
405
                'Found invalid website code %s in file %s on line %d',
406
                $code,
407
                $this->getFilename(),
408
                $this->getLineNumber()
409
            )
410
        );
411
    }
412
413
    /**
414
     * Return's the attribute set with the passed attribute set name.
@@ 421-438 (lines=18) @@
418
     * @return array The attribute set data
419
     * @throws \Exception Is thrown, if the attribute set with the passed name is not available
420
     */
421
    public function getAttributeSetByAttributeSetName($attributeSetName)
422
    {
423
424
        // query whether or not, the requested attribute set is available
425
        if (isset($this->attributeSets[$attributeSetName])) {
426
            return $this->attributeSets[$attributeSetName];
427
        }
428
429
        // throw an exception, if not
430
        throw new \Exception(
431
            sprintf(
432
                'Found invalid attribute set name %s in file %s on line %d',
433
                $attributeSetName,
434
                $this->getFilename(),
435
                $this->getLineNumber()
436
            )
437
        );
438
    }
439
440
    /**
441
     * Return's the category with the passed path.
@@ 448-465 (lines=18) @@
445
     * @return array The category
446
     * @throws \Exception Is thrown, if the requested category is not available
447
     */
448
    public function getCategoryByPath($path)
449
    {
450
451
        // query whether or not the category with the passed path exists
452
        if (isset($this->categories[$path])) {
453
            return $this->categories[$path];
454
        }
455
456
        // throw an exception, if not
457
        throw new \Exception(
458
            sprintf(
459
                'Can\'t find category with path %s in file %s on line %d',
460
                $path,
461
                $this->getFilename(),
462
                $this->getLineNumber()
463
            )
464
        );
465
    }
466
467
    /**
468
     * Return's the category with the passed ID.

src/Subjects/BunchSubject.php 1 location

@@ 348-365 (lines=18) @@
345
     * @return integer The requested visibility key
346
     * @throws \Exception Is thrown, if the requested visibility is not available
347
     */
348
    public function getVisibilityIdByValue($visibility)
349
    {
350
351
        // query whether or not, the requested visibility is available
352
        if (isset($this->availableVisibilities[$visibility])) {
353
            return $this->availableVisibilities[$visibility];
354
        }
355
356
        // throw an exception, if not
357
        throw new \Exception(
358
            sprintf(
359
                'Found invalid visibility %s in file %s on line %d',
360
                $visibility,
361
                $this->getFilename(),
362
                $this->getLineNumber()
363
            )
364
        );
365
    }
366
367
    /**
368
     * Map the passed attribute code, if a header mapping exists and return the