<?php

class FactorySection
{


    public static function load($class, $nameClass = null, $dossier = null)
    {
        $classe = $class;
        if ($dossier == null)
            $chemin = '../class/';
        else
            $chemin = '../' . $dossier . '/';
        if (file_exists($chemin = $chemin . $classe . '.class.php')) {
            require_once $chemin;
            if ($nameClass == null)
                return new $classe();
            else
                return new $nameClass();
        } else {
            throw new RuntimeException(strBuild(trad('La classe @1@ n\'a pu être trouvée !'), $chemin));
        }
    }
}