<?php if (!defined('REDE_LIBRARY')) { die('No direct script access allowed'); }
/**
 * Prestashop
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * @category    Payment
 * @package     eRede
 * @copyright   Copyright (c) 2013 Rede (http://www.userede.com.br)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */

class RedeAutoloader {
	public static $loader;
	
	private static $classes = array('Endereco','Logs','ProdutoRisco','Servico','TokenHelper','TokenRetorno','TokenSetup');
	
	private function __construct() {
		self::loadClasses();
	}

	public static function init() {
		if (self::$loader == null) {
			self::$loader = new RedeAutoloader();
		}
		return self::$loader;
	}

	private function loadClasses()
	{
		foreach(self::$classes as $key => $classe) {
			$file = RedeLibrary::getPath().DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.$classe.'.class.php';
			if (file_exists($file) && is_file($file)) {
				require_once $file;
			}
		}
	}
	
}
?>