You are here

protected function EasyRdf_Parser::checkParseParams in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser.php \EasyRdf_Parser::checkParseParams()

Check, cleanup parameters and prepare for parsing @ignore

10 calls to EasyRdf_Parser::checkParseParams()
EasyRdf_Parser_Arc::parse in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Arc.php
Parse an RDF document into an EasyRdf_Graph
EasyRdf_Parser_Json::parse in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Json.php
Parse RDF/JSON into an EasyRdf_Graph
EasyRdf_Parser_JsonLd::parse in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/JsonLdImplementation.php
Parse a JSON-LD document into an EasyRdf_Graph
EasyRdf_Parser_Ntriples::parse in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Ntriples.php
Parse an N-Triples document into an EasyRdf_Graph
EasyRdf_Parser_Rapper::parse in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Rapper.php
Parse an RDF document into an EasyRdf_Graph

... See full list

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Parser.php, line 89

Class

EasyRdf_Parser
Parent class for the EasyRdf parsers

Code

protected function checkParseParams($graph, $data, $format, $baseUri) {
  if ($graph == null or !is_object($graph) or !$graph instanceof EasyRdf_Graph) {
    throw new InvalidArgumentException("\$graph should be an EasyRdf_Graph object and cannot be null");
  }
  else {
    $this->graph = $graph;
  }
  if ($format == null or $format == '') {
    throw new InvalidArgumentException("\$format cannot be null or empty");
  }
  elseif (is_object($format) and $format instanceof EasyRdf_Format) {
    $this->format = $format = $format
      ->getName();
  }
  elseif (!is_string($format)) {
    throw new InvalidArgumentException("\$format should be a string or an EasyRdf_Format object");
  }
  else {
    $this->format = $format;
  }
  if ($baseUri) {
    if (!is_string($baseUri)) {
      throw new InvalidArgumentException("\$baseUri should be a string");
    }
    else {
      $this->baseUri = new EasyRdf_ParsedUri($baseUri);
    }
  }
  else {
    $this->baseUri = null;
  }

  // Prepare for parsing
  $this
    ->resetBnodeMap();
  $this->tripleCount = 0;
}