EntryType   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 30
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getRecordDefinition() 0 8 1
A saveRecord() 0 4 1
A deleteRecord() 0 4 1
1
<?php
2
3
namespace NerdsAndCompany\Schematic\Converters\Models;
4
5
use Craft;
6
use craft\base\Model;
7
8
/**
9
 * Schematic Entry Types Converter.
10
 *
11
 * Sync Craft Setups.
12
 *
13
 * @author    Nerds & Company
14
 * @copyright Copyright (c) 2015-2019, Nerds & Company
15
 * @license   MIT
16
 *
17
 * @see      http://www.nerds.company
18
 */
19
class EntryType extends Base
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24 1
    public function getRecordDefinition(Model $record): array
25
    {
26 1
        $definition = parent::getRecordDefinition($record);
27
28 1
        unset($definition['attributes']['sectionId']);
29
30 1
        return $definition;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 1
    public function saveRecord(Model $record, array $definition): bool
37
    {
38 1
        return Craft::$app->sections->saveEntryType($record);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44 1
    public function deleteRecord(Model $record): bool
45
    {
46 1
        return Craft::$app->sections->deleteEntryType($record);
47
    }
48
}
49