Completed
Push — master ( 3d202a...ec3201 )
by Ryan
07:25
created

SectionNormalizer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 15 3
1
<?php namespace Anomaly\Streams\Platform\Ui\Form\Component\Section;
2
3
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
4
5
/**
6
 * Class SectionNormalizer
7
 *
8
 * @link          http://pyrocms.com/
9
 * @author        PyroCMS, Inc. <[email protected]>
10
 * @author        Ryan Thompson <[email protected]>
11
 * @package       Anomaly\Streams\Platform\Ui\Form\Component\Section
12
 */
13
class SectionNormalizer
14
{
15
16
    /**
17
     * Normalize the sections.
18
     *
19
     * @param FormBuilder $builder
20
     */
21
    public function normalize(FormBuilder $builder)
22
    {
23
        $sections = $builder->getSections();
24
25
        foreach ($sections as $slug => &$section) {
26
27
            if (is_string($section)) {
28
                $section = [
29
                    'view' => $section
30
                ];
31
            }
32
        }
33
34
        $builder->setSections($sections);
35
    }
36
}
37