LBCAlerte_ynh/sources/lib/AdService/ParserFactory.php
Jimmy Monin 57708e3169 Initial commit
Functional, without SSO
2016-09-18 11:03:26 +02:00

24 lines
543 B
PHP

<?php
namespace AdService;
class ParserFactory
{
/**
* @param string $url
* @return \AdService\Parser\AbstractParser
*/
public static function factory($url)
{
if (false !== strpos($url, "leboncoin.fr")) {
return new Parser\Lbc();
}
if (false !== strpos($url, "olx.ua")) {
return new Parser\Olx();
}
if (false !== strpos($url, "seloger.com")) {
return new Parser\Seloger();
}
throw new Exception("No parser found");
}
}