File tree Expand file tree Collapse file tree 1 file changed +31
-7
lines changed Expand file tree Collapse file tree 1 file changed +31
-7
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,37 @@ final class Comment
2525 */
2626 public static function isCommentString ($ string )
2727 {
28- return
29- $ string [0 ] === '# '
30- || (
31- isset ($ string [1 ])
32- && ($ string [0 ] === '- ' && $ string [1 ] === '- ' )
33- || ($ string [0 ] === '/ ' && $ string [1 ] === '* ' )
34- );
28+ return $ string [0 ] === '# ' || self ::isTwoCharacterComment ($ string );
29+ }
30+
31+ /**
32+ * @param $string
33+ *
34+ * @return bool
35+ */
36+ protected static function isTwoCharacterComment ($ string )
37+ {
38+ return isset ($ string [1 ]) && (self ::startsWithDoubleDash ($ string ) || self ::startsAsBlock ($ string ));
39+ }
40+
41+ /**
42+ * @param $string
43+ *
44+ * @return bool
45+ */
46+ protected static function startsWithDoubleDash ($ string )
47+ {
48+ return $ string [0 ] === '- ' && ($ string [1 ] === $ string [0 ]);
49+ }
50+
51+ /**
52+ * @param $string
53+ *
54+ * @return bool
55+ */
56+ protected static function startsAsBlock ($ string )
57+ {
58+ return $ string [0 ] === '/ ' && $ string [1 ] === '* ' ;
3559 }
3660
3761 /**
You can’t perform that action at this time.
0 commit comments