<?php

/*
 * This file is part of the Pagerfanta package.
 *
 * (c) Pablo Díez <pablodip@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Pagerfanta\View;

use Pagerfanta\PagerfantaInterface;

/**
 * ViewFactoryInterface.
 *
 * @author Pablo Díez <pablodip@gmail.com>
 *
 * @api
 */
interface ViewFactoryInterface
{
    /**
     * Sets a view.
     *
     * @param string        $name The view name.
     * @param ViewInterface $view The view.
     */
    function set($name, ViewInterface $view);

    /**
     * Returns whether a view exists or not.
     *
     * @param string $name The name.
     *
     * @return Boolean Whether a view exists or not.
     *
     * @api
     */
    function has($name);

    /**
     * Adds views.
     *
     * @param array $views An array of views.
     *
     * @api
     */
    function add(array $views);

    /**
     * Returns a view.
     *
     * @param string $name The name.
     *
     * @return ViewInterface The view.
     *
     * @throws \InvalidArgumentException If the view does not exist.
     *
     * @api
     */
    function get($name);

    /**
     * Returns all the views.
     *
     * @return array The views.
     */
    function all();

    /**
     * Removes a view.
     *
     * @param string $name The name.
     *
     * @throws \InvalidArgumentException If the view does not exist.
     *
     * @api
     */
    function remove($name);

    /**
     * Clears the views.
     *
     * @api
     */
    function clear();
}
