You are here

public function EasyRdf_Parser_Rapper::__construct in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Rapper.php \EasyRdf_Parser_Rapper::__construct()

Constructor

Parameters

string $rapperCmd Optional path to the rapper command to use.:

Return value

object EasyRdf_Parser_Rapper

Overrides EasyRdf_Parser_Json::__construct

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Rapper.php, line 57

Class

EasyRdf_Parser_Rapper
Class to parse RDF using the 'rapper' command line tool.

Code

public function __construct($rapperCmd = 'rapper') {
  $result = exec("{$rapperCmd} --version 2>/dev/null", $output, $status);
  if ($status != 0) {
    throw new EasyRdf_Exception("Failed to execute the command '{$rapperCmd}': {$result}");
  }
  elseif (version_compare($result, self::MINIMUM_RAPPER_VERSION) < 0) {
    throw new EasyRdf_Exception("Version " . self::MINIMUM_RAPPER_VERSION . " or higher of rapper is required.");
  }
  else {
    $this->rapperCmd = $rapperCmd;
  }
}