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;
	}
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;
	}
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 ; }
Takes the given content and parses it into a populated Log object.

@param string[] $content

@return Log
Takes the given content and parses it into a populated Log object .