Completed
Push — master ( 3a2539...1698f0 )
by Steve
02:34
created

IterativeTransform   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A shouldRecurse() 0 4 2
1
<?php
2
3
namespace StoutLogic\AcfBuilder\Transform;
4
5
/**
6
 * Transform applies to all leafs in array at a single field level,
7
 * it doesn't recurse down fields, sub_fields or layouts.
8
 */
9
abstract class IterativeTransform extends RecursiveTransform
10
{
11
    /**
12
     * Define a list of array keys `transform` should not be recursed upon.
13
     * @var array
14
     */
15
    protected $dontRecurseKeys = ['fields', 'sub_fields', 'layouts'];
16
17
    protected function shouldRecurse($value, $key)
18
    {
19
        return is_array($value) && !in_array($key, $this->dontRecurseKeys, true);
20
    }
21
}
22