<?php
namespace App\Utils\BaseParser;

/**
 * Trait that should be used by extendable classes that implement the setOption/getOption pattern
 */
trait OptionTrait
{
	/**
	 * The internal options list
	 * @var array
	 */
    protected $options = [];

	/**
	 * Set one option
	 * @param string $key
	 * @param mixed $value
	 * @return $this
	 */
	public function setOption(string $key, $value)
	{
		$this->options[$key] = $value;

		return $this;
	}

	/**
	 * Get one option's value
	 * @param string $key
	 * @return mixed
	 */
	public function getOption(string $key)
	{
		return $this->options[$key];
	}

	/**
	 * Get all options
	 * @return array
	 */
	public function getOptions()
	{
		return $this->options;
	}

}
