<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Jure
 * Date: 13.3.14
 * Time: 19:59
 * To change this template use File | Settings | File Templates.
 */

class Autoloader {
    public function __construct() {
        spl_autoload_register(array($this, 'loader'));
    }
    private function loader($class) {

        if(file_exists('../Library/Infrastructure/'.$class . '.php')){
            include '../Library/Infrastructure/' . $class . ".php";
        }
        elseif(file_exists('../Library/Exceptions/'.$class . '.php')){
            include '../Library/Exceptions/' . $class . ".php";
        }
        elseif(file_exists('../Library/Models/'.$class . '.php')){

            include '../Library/Models/' . $class . ".php";
        }
        elseif(file_exists('../Library/Service/'.$class . '.php')){
            include '../Library/Service/' . $class . '.php';

        }
        elseif(file_exists('../Library/Service/Implementation/'.$class . '.php')){
            include '../Library/Service/Implementation/' . $class . '.php';
        }else{
            echo 'Loading failed';

        }
    }
}

