Completed
Push — 2.0 ( 34a54d...c1043f )
by Raphaël
11:03 queued 09:09
created

ComponentHelper::createFieldFromArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
nc 2
cc 2
nop 1
1
<?php
2
3
namespace Wabel\Zoho\CRM\Helpers;
4
5
6
use Wabel\Zoho\CRM\BeanComponents\Field;
7
8
class ComponentHelper
9
{
10
11
    /**
12
     * @param array $fieldConfigurations
13
     * @return Field
14
     */
15
    public static function createFieldFromArray(array $fieldConfigurations){
16
        $field = new Field();
17
        foreach ($fieldConfigurations as $keyFieldConfiguration => $valueFieldConfiguration){
18
            $method = 'set'.ucfirst($keyFieldConfiguration);
19
            $field->{$method}($valueFieldConfiguration);
20
        }
21
        return $field;
22
    }
23
}