You are here

protected function EasyRdf_Parser_Turtle::read in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php \EasyRdf_Parser_Turtle::read()

Read a single character from the input buffer. Returns -1 when the end of the file is reached. @ignore

19 calls to EasyRdf_Parser_Turtle::read()
EasyRdf_Parser_Turtle::parseCollection in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a collection [16], e.g: ( item1 item2 item3 ) @ignore
EasyRdf_Parser_Turtle::parseImplicitBlank in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a blankNodePropertyList [15]
EasyRdf_Parser_Turtle::parseLongString in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a """long string""". This method requires that the first three characters have already been parsed.
EasyRdf_Parser_Turtle::parseNodeID in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a blank node ID, e.g: _:node1 @ignore
EasyRdf_Parser_Turtle::parseNumber in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a numeric value, either of type integer, decimal or double @ignore

... See full list

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php, line 1157

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function read() {
  if (!empty($this->data)) {
    $c = mb_substr($this->data, 0, 1, "UTF-8");

    // Keep tracks of which line we are on (0A = Line Feed)
    if ($c == "\n") {
      $this->line += 1;
      $this->column = 1;
    }
    else {
      $this->column += 1;
    }
    if (version_compare(PHP_VERSION, '5.4.8', '<')) {

      // versions of PHP prior to 5.4.8 treat "NULL" length parameter as 0
      $this->data = mb_substr($this->data, 1, mb_strlen($this->data), "UTF-8");
    }
    else {
      $this->data = mb_substr($this->data, 1, null, "UTF-8");
    }
    return $c;
  }
  else {
    return -1;
  }
}