Completed
Push — master ( 7ba73a...cfde8a )
by Steve
29s
created

TabBuilder::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
rs 9.6666
cc 1
eloc 6
nc 1
nop 3
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