/**
  * @dataProvider htmlProvider
  */
 function testSourceIsRemote(\ZendDirectoryInfo\DataAccess\Location $source)
 {
     if (filter_var($source->getLocation(), FILTER_VALIDATE_URL)) {
         $this->assertTrue(TRUE);
     } else {
         $this->fail("Source is not remote");
     }
 }
 /**
  * @param $source_path
  * @return DataSource
  * @throws \Exception
  */
 public static function open(Location $source_path)
 {
     $information = $source_path->getInformation()["Content-Type"];
     preg_match('@([\\w\\/+]+)(;\\s+(charset=(\\S+))?)?@i', $information, $matches);
     if (isset($matches[1])) {
         $mime = $matches[1];
     }
     switch ($mime) {
         case "application/json":
             return new JsonSource($source_path);
             break;
         case "text/html":
             return new HtmlSource($source_path, new \DOMDocument());
             break;
         default:
             throw new \InvalidArgumentException("Source of type: {$information} not supported");
     }
 }
 /**
  * DataSource constructor.
  * @param $source_path
  */
 public function __construct(\ZendDirectoryInfo\DataAccess\Location $source_path)
 {
     $this->source_path = $source_path->getLocation();
 }