AbstractBricksFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createFieldObject() 0 10 1
1
<?php
2
/**
3
 * User: jensk
4
 * Date: 13-3-2017
5
 * Time: 16:56
6
 */
7
8
namespace CloudControl\Cms\storage\factories;
9
10
11
use CloudControl\Cms\util\StringUtil;
12
13
abstract class AbstractBricksFactory
14
{
15
    /**
16
     * @param $postValues
17
     * @param $title
18
     * @param $fieldType
19
     *
20
     * @return \stdClass
21
     */
22
    protected static function createFieldObject($postValues, $title, $fieldType)
23
    {
24
        $fieldObject = new \stdClass();
25
        $fieldObject->title = $title;
26
        $fieldObject->slug = StringUtil::slugify($title);
27
        $fieldObject->type = $postValues['fieldTypes'][$fieldType];
28
        $fieldObject->required = ($postValues['fieldRequired'][$fieldType] === 'true');
29
        $fieldObject->multiple = ($postValues['fieldMultiple'][$fieldType] === 'true');
30
31
        return $fieldObject;
32
    }
33
}