Code Duplication    Length = 14-15 lines in 2 locations

src/Services/CategoryGroups.php 1 location

@@ 141-155 (lines=15) @@
138
     * @param array          $categoryGroupDefinition
139
     * @param string         $categoryGroupHandle
140
     */
141
    private function populateCategoryGroup(CategoryGroupModel $categoryGroup, array $categoryGroupDefinition, $categoryGroupHandle)
142
    {
143
        $categoryGroup->setAttributes([
144
            'handle' => $categoryGroupHandle,
145
            'name' => $categoryGroupDefinition['name'],
146
            'hasUrls' => $categoryGroupDefinition['hasUrls'],
147
            'template' => $categoryGroupDefinition['template'],
148
            'maxLevels' => $categoryGroupDefinition['maxLevels'],
149
        ]);
150
151
        $this->populateCategoryGroupLocales($categoryGroup, $categoryGroupDefinition['locales']);
152
153
        $fieldLayout = Craft::app()->schematic_fields->getFieldLayout($categoryGroupDefinition['fieldLayout']);
154
        $categoryGroup->setFieldLayout($fieldLayout);
155
    }
156
157
    /**
158
     * Populate section locales.

src/Services/Sections.php 1 location

@@ 334-347 (lines=14) @@
331
     * @param string         $entryTypeHandle
332
     * @param int            $sectionId
333
     */
334
    private function populateEntryType(EntryTypeModel $entryType, array $entryTypeDefinition, $entryTypeHandle, $sectionId)
335
    {
336
        $entryType->setAttributes([
337
            'handle' => $entryTypeHandle,
338
            'sectionId' => $sectionId,
339
            'name' => $entryTypeDefinition['name'],
340
            'hasTitleField' => $entryTypeDefinition['hasTitleField'],
341
            'titleLabel' => $entryTypeDefinition['titleLabel'],
342
            'titleFormat' => $entryTypeDefinition['titleFormat'],
343
        ]);
344
345
        $fieldLayout = Craft::app()->schematic_fields->getFieldLayout($entryTypeDefinition['fieldLayout']);
346
        $entryType->setFieldLayout($fieldLayout);
347
    }
348
349
    /**
350
     * Reset craft section model cache using reflection