Code Duplication    Length = 18-18 lines in 5 locations

src/Subjects/AbstractProductSubject.php 4 locations

@@ 425-442 (lines=18) @@
422
     * @return integer The tax class ID
423
     * @throws \Exception Is thrown, if the tax class with the requested name is not available
424
     */
425
    public function getTaxClassIdByTaxClassName($taxClassName)
426
    {
427
428
        // query whether or not, the requested tax class is available
429
        if (isset($this->taxClasses[$taxClassName])) {
430
            return (integer) $this->taxClasses[$taxClassName][MemberNames::CLASS_ID];
431
        }
432
433
        // throw an exception, if not
434
        throw new \Exception(
435
            sprintf(
436
                'Found invalid tax class name %s in file %s on line %d',
437
                $taxClassName,
438
                $this->getFilename(),
439
                $this->getLineNumber()
440
            )
441
        );
442
    }
443
444
    /**
445
     * Return's the store website for the passed code.
@@ 452-469 (lines=18) @@
449
     * @return integer The store website ID
450
     * @throws \Exception Is thrown, if the store website with the requested code is not available
451
     */
452
    public function getStoreWebsiteIdByCode($code)
453
    {
454
455
        // query whether or not, the requested store website is available
456
        if (isset($this->storeWebsites[$code])) {
457
            return (integer) $this->storeWebsites[$code][MemberNames::WEBSITE_ID];
458
        }
459
460
        // throw an exception, if not
461
        throw new \Exception(
462
            sprintf(
463
                'Found invalid website code %s in file %s on line %d',
464
                $code,
465
                $this->getFilename(),
466
                $this->getLineNumber()
467
            )
468
        );
469
    }
470
471
    /**
472
     * Return's the attribute set with the passed attribute set name.
@@ 479-496 (lines=18) @@
476
     * @return array The attribute set data
477
     * @throws \Exception Is thrown, if the attribute set with the passed name is not available
478
     */
479
    public function getAttributeSetByAttributeSetName($attributeSetName)
480
    {
481
482
        // query whether or not, the requested attribute set is available
483
        if (isset($this->attributeSets[$attributeSetName])) {
484
            return $this->attributeSets[$attributeSetName];
485
        }
486
487
        // throw an exception, if not
488
        throw new \Exception(
489
            sprintf(
490
                'Found invalid attribute set name %s in file %s on line %d',
491
                $attributeSetName,
492
                $this->getFilename(),
493
                $this->getLineNumber()
494
            )
495
        );
496
    }
497
498
    /**
499
     * Return's the category with the passed path.
@@ 506-523 (lines=18) @@
503
     * @return array The category
504
     * @throws \Exception Is thrown, if the requested category is not available
505
     */
506
    public function getCategoryByPath($path)
507
    {
508
509
        // query whether or not the category with the passed path exists
510
        if (isset($this->categories[$path])) {
511
            return $this->categories[$path];
512
        }
513
514
        // throw an exception, if not
515
        throw new \Exception(
516
            sprintf(
517
                'Can\'t find category with path %s in file %s on line %d',
518
                $path,
519
                $this->getFilename(),
520
                $this->getLineNumber()
521
            )
522
        );
523
    }
524
525
    /**
526
     * Return's the category with the passed ID.

src/Subjects/BunchSubject.php 1 location

@@ 332-349 (lines=18) @@
329
     * @return integer The requested visibility key
330
     * @throws \Exception Is thrown, if the requested visibility is not available
331
     */
332
    public function getVisibilityIdByValue($visibility)
333
    {
334
335
        // query whether or not, the requested visibility is available
336
        if (isset($this->availableVisibilities[$visibility])) {
337
            return $this->availableVisibilities[$visibility];
338
        }
339
340
        // throw an exception, if not
341
        throw new \Exception(
342
            sprintf(
343
                'Found invalid visibility %s in file %s on line %d',
344
                $visibility,
345
                $this->getFilename(),
346
                $this->getLineNumber()
347
            )
348
        );
349
    }
350
351
    /**
352
     * Map the passed attribute code, if a header mapping exists and return the