<?php

namespace App\Integrations\Common;

use Solarium\Exception\InvalidArgumentException;

/**
 * Interface for configurable classes.
 *
 * All classes implementing this interface are  configurable using the constructor or
 * setOption calls.
 */
interface ConfigurableInterface
{
    /**
     * Set options.
     *
     * If $options is an object it will be converted into an array by called
     * it's toArray method.
     *
     *
     * @param array $options
     * @param bool  $overwrite True for overwriting existing options, false
     *                         for merging (new values overwrite old ones if needed)
     *
     * @throws InvalidArgumentException
     */
    public function setOptions($options, $overwrite = false);

    /**
     * Get an option value by name.
     *
     * If the option is empty or not set a NULL value will be returned.
     *
     * @param string $name
     *
     * @return mixed
     */
    public function getOption($name);

    /**
     * Get all options.
     *
     * @return array
     */
    public function getOptions();
}
