protected function parseContent($content, &$position, $pattern, $optional, $type)
    {
        $this->typeCheck->parseContent(func_get_args());

        $subject = substr($content, $position - 1);
        if (
            !preg_match($pattern, $subject, $matches) ||
            '' === $matches[1]
        ) {
            if ($optional) {
                return null;
            }

            throw new Exception\UnexpectedContentException(
                $type,
                $position
            );
        }

        $position += strlen($matches[0]);

        return $matches[1];
    }
protected function parseContent($content, &$position, $pattern, $optional, $type)
    {
        $this->typeCheck->parseContent(func_get_args());

        $subject = substr($content, $position - 1);
        if (
            !preg_match($pattern, $subject, $matches) ||
            '' === $matches[1]
        ) {
            if ($optional) {
                return null;
            }

            throw new Exception\UnexpectedContentException(
                $type,
                $position
            );
        }

        $position += strlen($matches[0]);

        return $matches[1];
    }
@param string $content
@param integer &$position
@param string  $pattern
@param boolean $optional
@param string  $type

@return string|null