@@ -3,33 +3,34 @@ class PHPCtags
33{
44 private $ mFile ;
55
6- private $ mParser ;
7-
86 private static $ mKinds = array (
9- 'c ' => 'class ' ,
10- 'm ' => 'method ' ,
11- 'f ' => 'function ' ,
12- 'p ' => 'property ' ,
13- 'd ' => 'constant ' ,
14- 'v ' => 'variable ' ,
15- 'i ' => 'interface ' ,
16- );
7+ 'c ' => 'class ' ,
8+ 'm ' => 'method ' ,
9+ 'f ' => 'function ' ,
10+ 'p ' => 'property ' ,
11+ 'd ' => 'constant ' ,
12+ 'v ' => 'variable ' ,
13+ 'i ' => 'interface ' ,
14+ );
15+
16+ private $ mParser ;
1717
1818 public function __construct ()
1919 {
2020 $ this ->mParser = new PHPParser_Parser (new PHPParser_Lexer );
2121 }
2222
23- public function setMFile ($ file ) {
24- if (empty ($ file )) {
23+ public function setMFile ($ file )
24+ {
25+ if (empty ($ file )) {
2526 throw new PHPCtagsException ('No File specified. ' );
2627 }
2728
28- if (!file_exists ($ file )) {
29+ if (!file_exists ($ file )) {
2930 throw new PHPCtagsException ('Warning: cannot open source file " ' . $ file . '" : No such file ' );
3031 }
3132
32- if (!is_readable ($ file )) {
33+ if (!is_readable ($ file )) {
3334 throw new PHPCtagsException ('Warning: cannot open source file " ' . $ file . '" : File is not readable ' );
3435 }
3536
@@ -74,7 +75,8 @@ public static function stringSortByLine($str, $foldcase=FALSE)
7475 return $ str ;
7576 }
7677
77- private static function helperSortByLine ($ a , $ b ) {
78+ private static function helperSortByLine ($ a , $ b )
79+ {
7880 return $ a ['line ' ] > $ b ['line ' ] ? 1 : 0 ;
7981 }
8082
@@ -89,7 +91,7 @@ private function struct($node, $reset=FALSE, $parent=array())
8991
9092 $ kind = $ name = $ line = $ access = '' ;
9193
92- if (!empty ($ parent )) array_push ($ scope , $ parent );
94+ if (!empty ($ parent )) array_push ($ scope , $ parent );
9395
9496 if (is_array ($ node )) {
9597 foreach ($ node as $ subNode ) {
@@ -163,7 +165,7 @@ private function struct($node, $reset=FALSE, $parent=array())
163165 $ this ->struct ($ subNode );
164166 }
165167 } elseif ($ node instanceof PHPParser_Node_Expr_Assign) {
166- if (is_string ($ node ->var ->name )) {
168+ if (is_string ($ node ->var ->name )) {
167169 $ kind = 'v ' ;
168170 $ node = $ node ->var ;
169171 $ name = $ node ->name ;
@@ -193,7 +195,7 @@ private function struct($node, $reset=FALSE, $parent=array())
193195 );
194196 }
195197
196- if (!empty ($ parent )) array_pop ($ scope );
198+ if (!empty ($ parent )) array_pop ($ scope );
197199
198200 // if no --sort is given, sort by occurrence
199201 if (!isset ($ options ['sort ' ]) || $ options ['sort ' ] == 'no ' ) {
@@ -257,11 +259,11 @@ private function render($structs, $options)
257259 #field=s
258260 if (in_array ('s ' , $ options ['fields ' ]) && !empty ($ struct ['scope ' ])) {
259261 $ scope = array_pop ($ struct ['scope ' ]);
260- list ($ type ,$ name ) = each ($ scope );
262+ list ($ type , $ name ) = each ($ scope );
261263 switch ($ type ) {
262264 case 'method ' :
263265 $ scope = array_pop ($ struct ['scope ' ]);
264- list ($ p_type ,$ p_name ) = each ($ scope );
266+ list ($ p_type , $ p_name ) = each ($ scope );
265267 $ scope = 'method: ' . $ p_name . ':: ' . $ name ;
266268 break ;
267269 default :
0 commit comments