mirror of
https://github.com/ZeJMaN/LBCAlerte_ynh.git
synced 2025-06-08 05:25:30 +02:00
24 lines
543 B
PHP
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");
|
|
}
|
|
} |