lithium\analysis\Docblock::comment()

public static method

Parses a doc block into its major components of description, text and tags.

Parameters

  • string $comment

    The doc block string to be parsed

Returns

array

An associative array of the parsed comment, whose keys are description, text and tags.

Source

	public static function comment($comment) {
		$text = null;
		$tags = array();
		$description = null;
		$comment = trim(preg_replace('/^(\s*\/\*\*|\s*\*{1,2}\/|\s*\* ?)/m', '', $comment));
		$comment = str_replace("\r\n", "\n", $comment);

		if ($items = preg_split('/\n@/ms', $comment, 2)) {
			list($description, $tags) = $items + array('', '');
			$tags = $tags ? static::tags("@{$tags}") : array();
		}

		if (strpos($description, "\n\n")) {
			list($description, $text) = explode("\n\n", $description, 2);
		}
		$text = trim($text);
		$description = trim($description);
		return compact('description', 'text', 'tags');
	}