@@ -3,6 +3,8 @@ class PHPCtags
33{
44 private $ mFile ;
55
6+ private $ mFiles ;
7+
68 private static $ mKinds = array (
79 'c ' => 'class ' ,
810 'm ' => 'method ' ,
@@ -48,6 +50,18 @@ public static function getMKinds()
4850 return self ::$ mKinds ;
4951 }
5052
53+ public function addFile ($ file )
54+ {
55+ $ this ->mFiles [realpath ($ file )] = 1 ;
56+ }
57+
58+ public function addFiles ($ files )
59+ {
60+ foreach ($ files as $ file ) {
61+ $ this ->addFile ($ file );
62+ }
63+ }
64+
5165 private function getNodeAccess ($ node )
5266 {
5367 if ($ node ->isPrivate ()) return 'private ' ;
@@ -294,7 +308,20 @@ private function render()
294308 return $ str ;
295309 }
296310
297- public function export ($ file )
311+ public function export ()
312+ {
313+ if (empty ($ this ->mFiles )) {
314+ throw new PHPCtagsException ('No File specified. ' );
315+ }
316+
317+ foreach (array_keys ($ this ->mFiles ) as $ file ) {
318+ $ this ->process ($ file );
319+ }
320+
321+ return $ this ->render ();
322+ }
323+
324+ private function process ($ file )
298325 {
299326 if (is_dir ($ file ) && isset ($ this ->mOptions ['R ' ])) {
300327 $ iterator = new RecursiveIteratorIterator (
@@ -329,7 +356,6 @@ public function export($file)
329356 $ this ->struct ($ this ->mParser ->parse (file_get_contents ($ this ->mFile )), TRUE )
330357 );
331358 }
332- return $ this ->render ();
333359 }
334360}
335361
0 commit comments