PhpOrient\Protocols\Binary\Serialization\CSV::eatRID PHP Method

eatRID() protected static method

Consume a Record ID.
protected static eatRID ( string $input ) : array
$input string The input to consume
return array The collected RID and any remaining content.
    protected static function eatRID($input)
    {
        $length = strlen($input);
        $collected = '';
        $cluster = null;
        for ($i = 0; $i < $length; $i++) {
            $c = $input[$i];
            if ($cluster === null && $c === ':') {
                $cluster = (int) $collected;
                $collected = '';
            } elseif ($c === '-' || is_numeric($c)) {
                $collected .= $c;
            } else {
                break;
            }
        }
        return [new ID((string) $cluster, (string) $collected), substr($input, $i)];
    }