<?php
/**
 * Count class
 *
 * @author Lucas Dantas <lucas@caju.nu>
 * @package classes
 * @subpackage count
 * @version 1.0
 * @since 05/02/2015 16:58
 */
Class CountController{

	/**
	 * Defining the repository
	 *
	 * @access public
	 * @static
	 * @param string $type Instance's type
	 * @uses CountRepositoryDBR::getInstance Defining the instance
	 * @return mixed
	 */
	public static function getRepository( $type = null ){

		//Returning
		return CountRepositoryDBR::getInstance( $type );

	}

	/**
	 * Counting orderly
	 *
	 * @access public
	 * @static
	 * @param string $type Type
	 * @param string $email E-mail
	 * @uses self::getRepository Defining the repository
	 * @uses CountRepositoryDBR->byEmail Counting by e-mail
	 * @return integer
	 */
	public static function byEmail( $type = 'newsletter', $email = null ){

		//Returning
		return self::getRepository( $type )->byEmail( $email );

	}

}