30 private $configFilePool;
41 $this->configFilePool = $configFilePool;
73 $fileContent = $dirReader->readFile(
$fileName);
74 $commentBlocks = array_filter(
75 token_get_all($fileContent),
77 return T_DOC_COMMENT == $entry[0];
81 foreach ($commentBlocks as $commentBlock) {
82 $text = $this->getCommentText($commentBlock[1]);
83 $section = $this->getSectionName($commentBlock[1]);
85 if ($section &&
$text) {
99 private function getCommentText($commentBlock)
102 foreach (preg_split(
"/(\r?\n)/", $commentBlock) as $commentLine) {
103 if (preg_match(
'/^(?=\s+?\*[^\/])(.+)/', $commentLine, $matches)
104 &&
false === strpos($commentLine,
'For the section')
106 $commentsLine[] = preg_replace(
'/^(\*\s?)/',
'', trim($matches[1]));
110 return empty($commentsLine) ? null : implode(PHP_EOL, $commentsLine);
119 private function getSectionName($comment)
121 $pattern =
'/\s+\* For the section: (.+)\s/';
122 preg_match_all(
$pattern, $comment, $matches);
124 return empty($matches[1]) ? null : trim(array_shift($matches[1]));