for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace LeoCarmo\TelegramBot\Traits;
use LeoCarmo\TelegramBot\Helpers\Strings;
trait Fillable
{
/**
* Fill class with data
*
* @param array $data
*/
protected function fillData(array $data)
foreach ($data as $key => $value) {
$field = Strings::snakeCase($key);
if (property_exists($this, $field)) {
$this->$field = $value;
}