<?php

/**
 * Model class.
 *
 * @package northmill-online-shared
 */
declare (strict_types=1);
namespace Northmill_Online_Shared_Sync\Northmill_Online_Shared\Abstracts;

defined('ABSPATH') || exit;
/**
 * Class Model
 *
 * Represents a generic model.
 */
abstract class Data_Model
{
    /**
     * Constructor method for the class.
     *
     * @param array $args The arguments to be set as properties of the object (optional).
     *
     * @return void
     */
    public function __construct(array $args = array())
    {
        if (!empty($args)) {
            foreach ($args as $key => $value) {
                if (method_exists($this, 'set_' . $key)) {
                    $this->{'set_' . $key}($value);
                } else {
                    $this->{$key} = $value;
                }
            }
        }
    }
}
