Parse the CSV-content

@param  string $content
@return array
@throws ParseError
549426
protected function parseContent($content) {
		$lines  = explode(PHP_EOL, $content);
		$result = [];
		
		foreach ($lines as $lineNm => $lineRaw) {
			if (empty($lineRaw)) {
				continue;
			}
			
			$line = str_getcsv($lineRaw, $this->csvDelimiter, $this->csvEnclosure);
			
			// Lack of data detection
			if (count($line) < 2) {
				$template = 'Error has occurred while parsing CSV file for the file: "%s" on line %s';
				throw new ParseError(sprintf($template, $this->lastFilePath, $lineNm));
			}
			
			$id = trim($line[0]);
			
			// Override detection
			if (isset($result[$id])) {
				$template = 'Translation with ID "%s" is already defined in the file "%s"';
				throw new ParseError(sprintf($template, $id, $this->lastFilePath));
			}
			
			$result[$id] = trim($line[1]);
		}
		
		return $result;
	}
1272176
public function parse($content)
	{
		$log = new Log;
		$description = [];
		$links = [];
		$matches = [];
		$bodyEnded = false;

		$line = current($content);
		while ($line !== false)
		{
			$line = ltrim($line);

			if (preg_match('/^#(?!#).+/', $line) === 1)
			{
				$log->setTitle($this->trimHashes($line));
			}
			elseif (preg_match('/^##(?!#).+/', $line) === 1)
			{
				$release = $this->parseRelease($content);
				$log->addRelease($release);
				$bodyEnded = true;
			}
			elseif (preg_match('/^\[(.+)\]: (.+)/', $line, $matches))
			{
				if (count($matches) >= 3)
				{
					$links[$matches[1]] = $matches[2];
				}
				$bodyEnded = true;
			}
			elseif ( ! $bodyEnded)
			{
				$description[] = $line;
			}

			$line = next($content);
		}

		$log->setDescription(implode("\n", $description));

		// Assign the releases their real links
		$this->assignLinks($log, $links);

		return $log;
	}
516989
public function parse($content) {
    $this->resetFd();
    foreach ($this->formdataParts($content) as $part) {
      if (!$this->isLastPart($part)) {
        $this->processFormdataPart($part);
      }
    }
    $this->compileData();
    return $this->fd;
  }
761425
public function easyReadingContent($content)
	{
		global $post;

		if (isset($_GET['readable']) && $_GET['readable'] == '1' && get_field('easy_reading_select') == true && is_object($post) && isset($post->post_content) && in_the_loop() && is_main_query()) {
			$post_content = $post->post_content;
			if (strpos($post_content,  '<!--more-->') !== false) {
				$content_parts = explode('<!--more-->', $post_content);
				$post_content  = $content_parts[1];
			}
			$post_content 	   = preg_replace('/[^a-z]/i', '', sanitize_text_field($post_content));
			$sanitized_content = preg_replace('/[^a-z]/i', '', sanitize_text_field($content));

			if ($post_content == $sanitized_content) {
				$content = get_field('easy_reading_content');
				if (strpos($content,  '<!--more-->') !== false) {
					$content_parts = explode('<!--more-->', $content);
					$content = '<p class="lead">' . sanitize_text_field($content_parts[0]) . '</p>' . $content_parts[1];
				}
			}
		}

		return $content;
	}
54718
public static function parse($content)
    {
        $matter = array();

        $text = str_replace(PHP_EOL, $id = uniqid(), $content);

        $regex = '/^---' . $id . '(.*?)' . $id . '---/';

        if (preg_match($regex, $text, $matches) === 1) {
            $yaml = str_replace($id, PHP_EOL, $matches[1]);

            $matter = (array) Yaml::parse(trim($yaml));

            $body = str_replace($matches[0], '', $text);

            $content = str_replace($id, PHP_EOL, $body);
        }

        return array($matter, (string) trim($content));
    }
354357
private function tryParseXML($content)
	{
		$xml = new ProtectedXMLReader(null);
		if(!$xml->XML($content) || !$xml->read(-1))
			return false;
		if($xml->isElement(self::XML_ROOT))
		{
			$d = $xml->depth();
			while($xml->read($d))
			{
				if($xml->isElement(self::XML_KEY))
				{
					$keyD = $xml->depth();
					while($xml->read($keyD))
					{
						if($xml->isElement(self::XML_DATA))
						{
							$value = $xml->readTextInside();
							$this->hash = base64_decode($value);
							$xml->close();
							return true;
						}
					}
				}
			}
		}
		$xml->close();
		return false;
	}
572786
protected function parse(/*# string */ $contents)/*# : array */
    {
        $result = [];
        $regex = sprintf(
            '/^\s*+(%s)\s*+=\s*+(%s)(?:#.*+)?\s*$/m',
            $this->name_pattern,
            $this->value_pattern
        );
        if (preg_match_all($regex, $contents, $matched, \PREG_SET_ORDER)) {
            foreach ($matched as $m) {
                $result[$m[1]] = trim($m[2]);
            }
        }
        return $result;
    }
730106
public function parse($content)
    {
        $result = [];
        if (strpos($content, '@view') === false) {
            return $result;
        }

        if (preg_match_all($this->pattern, $content, $matches)) {

            for ($i = 0, $c = count($matches[0]); $i < $c; $i++) {
                $result[] = [
                    'property' => $matches[1][$i],
                    'value'    => $matches[2][$i],
                    'type'     => $this->getType($matches[2][$i])
                ];
            }

            return $result;
        }

        return $result;
    }
929942
protected function serialize($content)
    {
        if (!empty($content)) {
            if (is_object($content)) {
                $content = $this->serializer->serialize($content, 'json');
            }
        }

        return $content;
    }
1156807
public function parseLang($content) {
        $this->_content = $content;
        $this->_parseDebugStart();
        $this->_parsePath();
        $this->_parseGravatar();
        $this->_parseUrl();
        $this->_parsePhp();
        $this->_parseLang();
        $this->_parseForeach();
        $this->_parseFor();
        $this->_parseVar();
        $this->_parseVarFunc();
        $this->_parseCondition();
        $this->_parseFunction();
        $this->_parseException();
        $this->_parseDebugEnd();

        return $this->_content;
    }
551431
public function parseContent($content)
    {
        $cto = $this->getContentTypeObject();
        if (!empty($cto)) {
            return $cto->parseContent($content);
        } else {
            return $content;
        }
    }
519006
private function getContentData($content)
    {
        $res = [];
        $res['startStringPos'] = strpos($content, $this->startString) + strlen($this->startString);
        $res['endStringPos'] = strpos($content, $this->endString);
        $res['bundleList'] = substr($content, $res['startStringPos'], ($res['endStringPos'] - $res['startStringPos']));
        return $res;
    }
800425
public function parse($content)
    {
        if (!$content || strpos($content, '@') === false) {
            return [];
        }
        $ret = [];

        if (preg_match(self::VIEW_RENDER, $content, $match)) {
            $ret[0] = array_pop($match);
        } else {
            $ret[0] = null;
        }

        if (preg_match(self::VIEW_TEMPLATE_FILE, $content, $match)) {
            $ret[1] = array_pop($match);
        } else {
            $ret[1] = null;
        }

        if (preg_match_all(self::VIEW_PARAMETERS, $content, $match)) {

            foreach($match as $subMatch) {
                $ret[] = [$subMatch[0] => $subMatch[1]];
            }
        }

        return $ret;
    }
816899
protected function parseToken(string $content): array
    {
        $token = [
            self::TOKEN_NAME       => '',
            self::TOKEN_TYPE       => self::TAG_OPEN,
            self::TOKEN_CONTENT    => '<' . ($content = $this->repairPHP($content)) . '>',
            self::TOKEN_ATTRIBUTES => []
        ];

        //Some parts of text just looks like tags, but their not
        if (!preg_match('/^\/?[a-z0-9_:\/][a-z 0-9\._\-:\/]*/i', $content)) {
            $token[self::TOKEN_TYPE] = self::PLAIN_TEXT;
            unset($token[self::TOKEN_NAME], $token[self::TOKEN_NAME]);

            return $token;
        }

        //Local PHP isolation
        $isolator = new Isolator('-argument-', '-block-');

        //No PHP blocks
        $content = $isolator->isolatePHP($content);

        //Parsing arguments, due they already checked for open-close quotas we can use regular expression
        $attribute = '/(?P<name>[a-z0-9_\-\.\:]+)[ \n\t\r]*(?:(?P<equal>=)[ \n\t\r]*'
            . '(?P<value>[a-z0-9\-]+|\'[^\']+\'|\"[^\"]+\"|\"\"))?/si';

        preg_match_all($attribute, $content, $attributes);

        foreach ($attributes['value'] as $index => $value) {
            if ($value && ($value{0} == "'" || $value{0} == '"')) {
                $value = trim($value, $value{0});
            }

            //Local and global php isolation restore
            $name = $this->repairPHP($isolator->repairPHP($attributes['name'][$index]));

            $token[self::TOKEN_ATTRIBUTES][$name] = $this->repairPHP($isolator->repairPHP($value));

            if (empty($attributes['equal'][$index])) {
                $token[self::TOKEN_ATTRIBUTES][$name] = null;
            }
        }

        //Fetching name
        $name = $isolator->repairPHP(current(explode(' ', $content)));
        if ($name{0} == '/') {
            $token[self::TOKEN_TYPE] = self::TAG_CLOSE;
            unset($token[self::TOKEN_ATTRIBUTES]);
        }

        if ($content{strlen($content) - 1} == '/') {
            $token[self::TOKEN_TYPE] = self::TAG_SHORT;
        }

        $token[self::TOKEN_NAME] = $name = trim($name, '/');
        unset($token[self::TOKEN_ATTRIBUTES][$name]);

        $token[self::TOKEN_NAME] = trim($token[self::TOKEN_NAME]);

        if (
            $token[self::TOKEN_TYPE] == self::TAG_OPEN
            && in_array($token[self::TOKEN_NAME], $this->voidTags)
        ) {
            $token[self::TOKEN_TYPE] = self::TAG_VOID;
        }

        return $token;
    }
626193
public function prepareContent($content)
    {
        if (is_array($content)) {
            $ctt = '';
            foreach ($content as $key=>$ctt) {
                $content .= $ctt;
            }
            $content = $ctt;
        }
        $_escaped_output = strip_tags((string) $content);
        if ($_escaped_output != (string) $content) {
            if (preg_match('/(.*)<body(.*)</body>/i', (string) $content, $matches)) {
                $_output = $matches[0];
            } else {
                $_output = (string) $content;
            }
            $content = Html2Text::convert($_output);
        }
        return (string) $content;
    }
752071
private static function _parseKeys(array &$content)
    {
        foreach($content as $key => $value) {
            if (strpos($key, self::SEPARATOR) !== false) {
                $pieces = explode(self::SEPARATOR, $key);

                $arr = &$content;
                foreach($pieces as $piece) {
                    if (! isset($arr[$piece])) {
                        $arr[$piece] = '';
                    }
                    $arr = &$arr[$piece];
                }

                if (is_array($value)) {
                    self::_parseKeys($value);
                }

                $arr = $value;

                unset($content[$key]);
            } else if (is_array($value)) {
                $arr = &$content[$key];
                self::_parseKeys($value);
                $arr = $value;
            }
        }
    }
271020
public function parseNewPagesFrom($content) {
		$pages = array();
		if (preg_match_all('/\[\[([\w\s_.-]+)\]\]/', $content, $matches)) {
			// exit(print_r($matches));
			foreach ($matches[1] as $pageTitle) {
				$pages[] = $pageTitle;
			}
		}

		return $pages;
	}