Completed
Branch FET/reg-form-builder/main (a66e69)
by
unknown
09:49 queued 19s
created

FormSectionStatusEnum   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 41
loc 41
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 9 9 1
A getValues() 20 20 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace EventEspresso\core\domain\services\graphql\enums;
4
5
use EventEspresso\core\services\graphql\enums\EnumBase;
6
use EventEspresso\core\services\form\meta\Element;
7
8
/**
9
 * Class FormSectionStatusEnum
10
 * Description
11
 *
12
 * @package EventEspresso\core\domain\services\graphql\enums
13
 * @author  Manzoor Wani
14
 * @since   $VID:$
15
 */
16 View Code Duplication
class FormSectionStatusEnum extends EnumBase
17
{
18
19
    /**
20
     * FormSectionStatusEnum constructor.
21
     */
22
    public function __construct()
23
    {
24
        $this->setName($this->namespace . 'FormSectionStatusEnum');
25
        $this->setDescription(esc_html__(
26
            'Whether form section is active, archived, shared, trashed, or used as a default on new forms.',
27
            'event_espresso'
28
        ));
29
        parent::__construct();
30
    }
31
32
33
    /**
34
     * @return array
35
     */
36
    protected function getValues(): array
37
    {
38
        return [
39
            'ACTIVE'   => [
40
                'value' => Element::STATUS_ACTIVE,
41
            ],
42
            'ARCHIVED' => [
43
                'value' => Element::STATUS_ARCHIVED,
44
            ],
45
            'DEFAULT'  => [
46
                'value' => Element::STATUS_DEFAULT,
47
            ],
48
            'SHARED'   => [
49
                'value' => Element::STATUS_SHARED,
50
            ],
51
            'TRASHED'  => [
52
                'value' => Element::STATUS_TRASHED,
53
            ],
54
        ];
55
    }
56
}
57