Fillable   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A fillData() 0 8 3
1
<?php
2
3
namespace LeoCarmo\TelegramBot\Traits;
4
5
use LeoCarmo\TelegramBot\Helpers\Strings;
6
7
trait Fillable
8
{
9
10
    /**
11
     * Fill class with data
12
     *
13
     * @param array $data
14
     */
15
    protected function fillData(array $data)
16
    {
17
        foreach ($data as $key => $value) {
18
19
            $field = Strings::snakeCase($key);
20
21
            if (property_exists($this, $field)) {
22
                $this->$field = $value;
23
            }
24
25
        }
26
    }
27
28
}