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

SectionNormalizer::normalize()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 15
rs 9.4285
cc 3
eloc 7
nc 3
nop 1
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