<?php
/**
 * Autoloader klas
 *
 * @link https://krzysztof-turek.com
 *
 * @package tylkofotografia.pl
 * @version 0.2
 */

function classAutoload($class) {

    $class = str_replace('\\', '/', $class);

    $path = dirname(__FILE__).'/classes/'.$class.'.php';
    if (is_readable($path)) {
        require_once $path;
        
        return;
    }
};

spl_autoload_register('classAutoload');

function traitAutoload($trait) {
    $trait = str_replace('\\', '/', $trait);

    $path = dirname(__FILE__).'/traits/'.$trait.'.php';
    if (is_readable($path)) {
        require_once $path;
        
        return;
    }
}
spl_autoload_register('traitAutoload');