@param string   $content
@param Document $document
@param int      $offset

@return bool|ElementString
500673
public static function parse($content, Document $document = null, &$offset = 0)
    {
        if (preg_match('/^\s*\((?P<name>.*)/s', $content, $match)) {
            $name = $match['name'];

            // Find next ')' not escaped.
            $cur_start_text = $start_search_end = 0;
            while (($cur_start_pos = strpos($name, ')', $start_search_end)) !== false) {
                $cur_extract = substr($name, $cur_start_text, $cur_start_pos - $cur_start_text);
                preg_match('/(?P<escape>[\\\]*)$/s', $cur_extract, $match);
                if (!(strlen($match['escape']) % 2)) {
                    break;
                }
                $start_search_end = $cur_start_pos + 1;
            }

            // Extract string.
            $name   = substr($name, 0, $cur_start_pos);
            $offset += strpos($content, '(') + $cur_start_pos + 2; // 2 for '(' and ')'
            $name   = str_replace(
                array('\\\\', '\\ ', '\\/', '\(', '\)', '\n', '\r', '\t'),
                array('\\',   ' ',   '/',   '(',  ')',  "\n", "\r", "\t"),
                $name
            );

            // Decode string.
            $name = Font::decodeOctal($name);
            $name = Font::decodeEntities($name);
            $name = Font::decodeHexadecimal($name, false);
            $name = Font::decodeUnicode($name);

            return new self($name, $document);
        }

        return false;
    }
733476
public function offsetGet($offset) {
		$this->getElements();
        return isset($this->elements[$this->getPosition($offset)]) ? $this->elements[$this->getPosition($offset)] : null;
    }
1359691
public function decode($content)
    {
        $result       = null;
        $this->errors = new ErrorCollection();

        $documentAsArray = json_decode($content, true);
        if ($documentAsArray !== null) {
            $result = $this->parseDocument($documentAsArray);

            return $this->errors->count() <= 0 ? $result : null;
        } else {
            return null;
        }
    }
1120661
public function offsetGet($offset) {
        return isset($this->nodes[$offset]) ? $this->nodes[$offset] : null;
    }
316144
public function indexOf($string, $offset = 0)
	{
		ArgumentValidator::validateScalar($string);
		ArgumentValidator::validateEmpty($string);
		ArgumentValidator::validateUnsignedInteger($offset);
		$index = mb_strpos($this->string, (string)$string, $offset);
		return $index === false ? null : $index;
	}
291507
function (element) {
      var docDomEl = $document[0];
      var offsetParent = element.offsetParent || docDomEl;
      while (offsetParent && offsetParent !== docDomEl && isStaticPositioned(offsetParent) ) {
        offsetParent = offsetParent.offsetParent;
      }
      return offsetParent || docDomEl;
    }
676002
protected function recordToElementWithAttribute(
        DOMDocument $doc,
        array $record,
        string $field_encoder,
        int $offset
    ): DOMElement {
        $node = $this->recordToElement($doc, $record, $field_encoder);
        $node->setAttribute($this->offset_attr, (string) $offset);

        return $node;
    }
1315029
public function offsetSet($offset, $value)
    {
        if (is_null($offset) || empty($offset)) {
            return null;
        }
        return $this->records[$offset] = $value;
    }
252755
public function get($offset = null)
    {
        if (!func_num_args()) {
            return $this->_data;
        }
        $keys = is_array($offset) ? $offset : explode('.', $offset);
        if (!$keys) {
            throw new ORMException("Invalid empty index `" . $offset . "` for collection.");
        }

        $name = array_shift($keys);
        if ($keys) {
            if (!array_key_exists($name, $this->_data)) {
                throw new ORMException("Missing index `" . $name . "` for collection.");
            }
            $value = $this->_data[$name];
            if (!$value instanceof DataStoreInterface) {
                throw new ORMException("The field: `" . $name . "` is not a valid document or entity.");
            }
            return $value->get($keys);
        }
        if (!array_key_exists($name, $this->_data)) {
            throw new ORMException("Missing index `" . $name . "` for collection.");
        }
        return $this->_data[$name];
    }
454864
public static function parse($content, Document $document = null, &$offset = 0)
    {
        if (preg_match('/^\s*<<(?P<struct>.*)/is', $content)) {
            preg_match_all('/(.*?)(<<|>>)/s', trim($content), $matches);

            $level = 0;
            $sub   = '';
            foreach ($matches[0] as $part) {
                $sub .= $part;
                $level += (strpos($part, '<<') !== false ? 1 : -1);
                if ($level <= 0) {
                    break;
                }
            }

            $offset += strpos($content, '<<') + strlen(rtrim($sub));

            // Removes '<<' and '>>'.
            $sub = trim(preg_replace('/^\s*<<(.*)>>\s*$/s', '\\1', $sub));

            $position = 0;
            $elements = Element::parse($sub, $document, $position);
            $header   = new Header($elements, $document);

            return $header;
        }

        return false;
    }
913111
public function offsetExists($offset) {
    if (is_string($offset)) {
      // To deal with php allowing function test($a, $a) loop in reverse.
      foreach (array_reverse($this->nodes) as $node) {
        if ($node instanceof ParameterNode) {
          if ($node->getName() === $offset) {
            return TRUE;
          }
        }
      }
      return FALSE;
    }
    return isset($this->nodes[$offset]);
  }
404819
protected function document(Document $document = null): ?Document {
        if ($document === null) {
            return $this->document;
        }

        $this->document = $document;

        return $this->document;
    }
579357
public function indexOf($string, $offset = 0) {
		$offset = $this->prepareOffset($offset);

		if ($string == '') {
			return $offset;
		}

		return mb_strpos($this->string, (string) $string, $offset, $this->encoding);
	}
1201303
public static function parse($content, Document $document = null, &$offset = 0)
    {
        if (preg_match('/^\s*\[(?P<array>.*)/is', $content, $match)) {
            preg_match_all('/(.*?)(\[|\])/s', trim($content), $matches);

            $level = 0;
            $sub   = '';
            foreach ($matches[0] as $part) {
                $sub .= $part;
                $level += (strpos($part, '[') !== false ? 1 : -1);
                if ($level <= 0) {
                    break;
                }
            }

            // Removes 1 level [ and ].
            $sub        = substr(trim($sub), 1, -1);
            $sub_offset = 0;
            $values     = Element::parse($sub, $document, $sub_offset, true);

            $offset += strpos($content, '[') + 1;
            // Find next ']' position
            $offset += strlen($sub) + 1;

            return new self($values, $document);
        }

        return false;
    }
999128
final public function fileGetContents($offset = -1, $maxlen = null)
	{
		$this->fseek($offset + 1, SEEK_SET);
		return $this->fread($maxlen);
	}
171683
public function tagElseif($tag, $content)
    {
        $condition = !empty($tag['expression']) ? $tag['expression'] : $tag['condition'];
        $condition = $this->parseCondition($condition);
        $parseStr  = '<?php elseif(' . $condition . '): ?>';

        return $parseStr;
    }
500627
public function offsetGet($offset)
    {
        foreach (array_merge($this->getXmlElements(), $this->getXmlAttributes()) as $attr) {
            if (strtolower($attr) == strtolower($offset)) {
                return \array_get($this->values, $attr);
            }
        }
        return null;
    }