Initial commit

Functional, without SSO
This commit is contained in:
Jimmy Monin
2016-09-18 11:03:26 +02:00
commit 57708e3169
253 changed files with 30787 additions and 0 deletions

View File

@ -0,0 +1,33 @@
<?php
namespace AdService;
class SiteConfigFactory
{
protected static $instances;
/**
* @param string $url
* @param bool $singleton en général, c'est la même config pour tous.
* @return \AdService\SiteConfig\AbstractSiteConfig
*/
public static function factory($url, $singleton=true)
{
if (false !== strpos($url, "leboncoin.fr")) {
$className = 'AdService\SiteConfig\Lbc';
} elseif (false !== strpos($url, "olx.ua")) {
$className = 'AdService\SiteConfig\Olx';
} elseif (false !== strpos($url, "www.seloger.com")) {
$className = 'AdService\SiteConfig\Seloger';
} else {
throw new Exception("No config found");
}
if ($singleton) {
if (!isset(self::$instances[$className])) {
self::$instances[$className] = new $className;
}
return self::$instances[$className];
}
return new $className;
}
}