File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ class PhpCode extends Extractor implements ExtractorInterface
1414 // - false: to not extract comments
1515 // - empty string: to extract all comments
1616 // - non-empty string: to extract comments that start with that string
17+ // - array with strings to extract comments format.
1718 'extractComments ' => false ,
1819
1920 'constants ' => [],
Original file line number Diff line number Diff line change @@ -16,18 +16,18 @@ class PhpFunctionsScanner extends FunctionsScanner
1616 /**
1717 * If not false, comments will be extracted.
1818 *
19- * @var string|false
19+ * @var string|false|array
2020 */
2121 protected $ extractComments = false ;
2222
2323 /**
2424 * Enable extracting comments that start with a tag (if $tag is empty all the comments will be extracted).
2525 *
26- * @param string $tag
26+ * @param mixed $tag
2727 */
2828 public function enableCommentsExtraction ($ tag = '' )
2929 {
30- $ this ->extractComments = ( string ) $ tag ;
30+ $ this ->extractComments = $ tag ;
3131 }
3232
3333 /**
@@ -157,11 +157,20 @@ protected function parsePhpComment($value)
157157 $ value = substr ($ value , 2 , -2 );
158158 }
159159 $ value = trim ($ value );
160- if ($ value !== '' && ($ this ->extractComments === '' || strpos ($ value , $ this ->extractComments ) === 0 )) {
161- $ result = $ value ;
160+ if ($ value !== '' ) {
161+ if ($ this ->extractComments === '' || strpos ($ value , $ this ->extractComments ) === 0 ) {
162+ $ result = $ value ;
163+ }
164+ elseif (is_array ($ this ->extractComments )) {
165+ foreach ($ this ->extractComments as $ string ) {
166+ if (strpos ($ value , $ string ) === 0 ) {
167+ $ result = $ value ;
168+ break ;
169+ }
170+ }
171+ }
162172 }
163173 }
164-
165174 return $ result ;
166175 }
167176}
You can’t perform that action at this time.
0 commit comments