<?php

class LdapImporterFactory
{

    const User = 'User';
    const Addresses = 'Addresses';

    public static function generateImporterOfType($modelType)
    {
        Log::d("Creating importer of type $modelType", 'LdapImporterFactory');
        if ($modelType === LdapImporterFactory::User) {
            $ldapImporter = new LdapUserImporter();
        } elseif ($modelType === LdapImporterFactory::Addresses) {
            $ldapImporter = new LdapAddressImporter();
        } else {
            throw new CHttpException(404, 'Invalid request. Object type does not exist.');
        }

        return $ldapImporter;
    }
}
