<?php

namespace Types;

/**
 * Class Type - Base Type class
 */
class Type {

	/**
	 * Populates properties from DB data
	 * @param null $data
	 */
	function __construct($data = null) {
		if ($data == null) return;
		$data = json_decode($data);
		foreach($data as $key => $val) {
			if(property_exists(__CLASS__,$key)) {
				$this->$key = $val;
			}
		}
	}

	/**
	 * Prepare for DB Storage
	 * @param $banner
	 * @return string
	 */
	public function serialize($banner){
		return json_encode($banner);
	}

}