Code Duplication    Length = 18-18 lines in 4 locations

src/Subjects/AbstractCategorySubject.php 2 locations

@@ 381-398 (lines=18) @@
378
     * @return integer The store website ID
379
     * @throws \Exception Is thrown, if the store website with the requested code is not available
380
     */
381
    public function getStoreWebsiteIdByCode($code)
382
    {
383
384
        // query whether or not, the requested store website is available
385
        if (isset($this->storeWebsites[$code])) {
386
            return (integer) $this->storeWebsites[$code][MemberNames::WEBSITE_ID];
387
        }
388
389
        // throw an exception, if not
390
        throw new \Exception(
391
            sprintf(
392
                'Found invalid website code %s in file %s on line %d',
393
                $code,
394
                $this->getFilename(),
395
                $this->getLineNumber()
396
            )
397
        );
398
    }
399
400
    /**
401
     * Return's the category with the passed path.
@@ 408-425 (lines=18) @@
405
     * @return array The category
406
     * @throws \Exception Is thrown, if the requested category is not available
407
     */
408
    public function getCategoryByPath($path)
409
    {
410
411
        // query whether or not the category with the passed path exists
412
        if (isset($this->categories[$path])) {
413
            return $this->categories[$path];
414
        }
415
416
        // throw an exception, if not
417
        throw new \Exception(
418
            sprintf(
419
                'Can\'t find category with path %s in file %s on line %d',
420
                $path,
421
                $this->getFilename(),
422
                $this->getLineNumber()
423
            )
424
        );
425
    }
426
427
    /**
428
     * Add the passed category to the available categories.

src/Subjects/BunchSubject.php 2 locations

@@ 98-115 (lines=18) @@
95
     * @return integer The requested display mode
96
     * @throws \Exception Is thrown, if the requested display mode is not available
97
     */
98
    public function getDisplayModeByValue($displayMode)
99
    {
100
101
        // query whether or not, the requested display mode is available
102
        if (isset($this->availableDisplayModes[$displayMode])) {
103
            return $this->availableDisplayModes[$displayMode];
104
        }
105
106
        // throw an exception, if not
107
        throw new \Exception(
108
            sprintf(
109
                'Found invalid display mode %s in file %s on line %d',
110
                $displayMode,
111
                $this->getFilename(),
112
                $this->getLineNumber()
113
            )
114
        );
115
    }
116
117
    /**
118
     * Return's the page layout for the passed page layout string.
@@ 125-142 (lines=18) @@
122
     * @return integer The requested page layout
123
     * @throws \Exception Is thrown, if the requested page layout is not available
124
     */
125
    public function getPageLayoutByValue($pageLayout)
126
    {
127
128
        // query whether or not, the requested display mode is available
129
        if (isset($this->availablePageLayouts[$pageLayout])) {
130
            return $this->availablePageLayouts[$pageLayout];
131
        }
132
133
        // throw an exception, if not
134
        throw new \Exception(
135
            sprintf(
136
                'Found invalid page layout %s in file %s on line %d',
137
                $pageLayout,
138
                $this->getFilename(),
139
                $this->getLineNumber()
140
            )
141
        );
142
    }
143
144
    /**
145
     * Return's the category with the passed ID.