<?php
/**
 * class slideResult_form
 *
 * Description for class slideResult_form
 *
 * @author:
*/
namespace form;

class slideResult_form {
	protected $slide = array();
	protected $config = array();
	protected $options = array();
	protected $optionsKeys = array();

	public function __construct($slide, $config, $options) {
		$this->slide = $slide;
		$this->config = $config;
		$this->options = $options;

		if(count($this->options) > 0) {
			foreach($this->options as $key => $option) {
				$this->optionsKeys[$key] = $option["option_id"];
			}
		}
	}

	protected function prepareOptions($sendData, $clearKeys = true) {
		if(is_array($sendData)) {
			$sendData = array_unique(array_filter($sendData));
			if($clearKeys) {
				return array_values($sendData);
			}
		}

		return $sendData;
	}

	protected function optionExist($option) {
		if(array_search($option, $this->optionsKeys) !== false) {
			return true;
		}

		return false;
	}
}
?>