Completed
Push — master ( 77b50b...7ba73a )
by Steve
46s
created

ConditionalLogic   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A transformValue() 0 5 1
1
<?php
2
3
namespace StoutLogic\AcfBuilder\Transform;
4
5
use StoutLogic\AcfBuilder\ConditionalBuilder;
6
7
/**
8
 * Applies the ConditionalField Transform to the conditional_logic value
9
 * of each field, in the field group config.
10
 */
11
class ConditionalLogic extends RecursiveTransform
12
{
13
    protected $keys = ['conditional_logic'];
14
15
    /**
16
     * Replace field values of a ConditionalBuilder with the proper keys using
17
     * the ConditionalField Transform.
18
     *
19
     * @param  ConditionalBuilder $value
20
     * @return array Transformed config array
21
     */
22
    public function transformValue($value)
23
    {
24
        $conditionalFieldTransform = new ConditionalField($this->getBuilder());
25
        return $conditionalFieldTransform->transform($value->build());
26
    }
27
}
28