/** * Trim the current stream so that everything that is * before the current object has been removed. */ private function trimStream() { // Get the current position after we have found the element. $position = strpos($this->stream, $this->loader->getElement()) + 1; while ($this->getStream()) { $streamLength = mb_strlen($this->stream); for ($i = $position; $i < $streamLength; $i++) { if (!ctype_space($this->stream[$i]) && $this->stream[$i] == '[') { // The stream will now read in the entire object $this->stream = substr($this->stream, ++$i); // Edge case where array was last char in string if ($this->stream === false) { $this->stream = ""; } // We are done here. return true; } } } $this->arrayEnd = true; return false; }