Completed
Pull Request — master (#23)
by Steve
02:25
created

TabBuilder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 27
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A endpoint() 0 4 1
A removeEndpoint() 0 4 1
1
<?php
2
3
namespace StoutLogic\AcfBuilder;
4
5
/**
6
 * Builds configurations for an ACF Field
7
 */
8
class TabBuilder extends FieldBuilder
9
{
10
    /**
11
     * @param string $name Field Name, conventionally 'snake_case'.
12
     * @param string $type Field Type.
13
     * @param array $config Additional Field Configuration.
14
     */
15
    public function __construct($name, $type = 'tab', $config = [])
16
    {
17
        $config = array_merge([
18
            'label' => $this->generateLabel($name),
19
        ], $config);
20
        $name = $this->generateName($name).'_tab';
21
22
        parent::__construct($name, $type, $config);
23
    }
24
25
    public function endpoint()
26
    {
27
        return $this->setConfig('endpoint', 1);
28
    }
29
30
    public function removeEndpoint()
31
    {
32
        return $this->setConfig('endpoint', 0);
33
    }
34
}
35