<?php

namespace FR\Traits;

trait FromArray
{
    public function fromArray(array $data = [])
    {
        foreach (array_keys($data) as $property) {

            if (!property_exists(self::class, $property)) {
                continue;
            }

            $this->{$property} = $data[$property];
        }
    }
}
