for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Thunder\SimilarWebApi;
/**
* @author Tomasz Kowalczyk <[email protected]>
*/
abstract class AbstractParser implements ParserInterface
{
protected $name;
protected $mapping;
public function __construct($name, array $mapping)
$this->name = $name;
$this->mapping = $mapping;
}
public function getResponse($content)
$response = $this->parse($content);
$class = 'Thunder\\SimilarWebApi\\Response\\'.$this->name;
if(!class_exists($class, true))
throw new \RuntimeException(sprintf('Failed to load response class %s!', $class));
return new $class($response);
abstract protected function parse($content);